Dear Team;
I want to remove "\n" from the text field through batch editing. The data file is in csdb format.
Please advice on how to resolve this issue.
thanks.
a.
How to remove \n from the text field
-
- Posts: 606
- Joined: July 9th, 2012, 11:32 am
- Location: Islamabad, Pakistan
-
- Posts: 1845
- Joined: December 5th, 2011, 11:27 pm
- Location: Washington, DC
Re: How to remove \n from the text field
If you're using CSPro 8.0+, you'd simply do:
STRING_FIELD = replace(STRING_FIELD, "\n", "");
-
- Posts: 606
- Joined: July 9th, 2012, 11:32 am
- Location: Islamabad, Pakistan
Re: How to remove \n from the text field
Dear Gregory;
I am using this in a batch file. When i run the application, it removes all informtion from the fields starting from the newline character ("\n") onward.
I am using cspro 7.7.
a.
I am using this in a batch file. When i run the application, it removes all informtion from the fields starting from the newline character ("\n") onward.
I am using cspro 7.7.
PROC RECOM_PSYCHOLOGIST1
Preproc
mystring =RECOM_PSYCHOLOGIST1;
mystring = replace(mystring, '\n', ' ');
RECOM_PSYCHOLOGIST1=mystring;
Thanks.Preproc
mystring =RECOM_PSYCHOLOGIST1;
mystring = replace(mystring, '\n', ' ');
RECOM_PSYCHOLOGIST1=mystring;
a.
-
- Posts: 606
- Joined: July 9th, 2012, 11:32 am
- Location: Islamabad, Pakistan
Re: How to remove \n from the text field
One more thing:
After getting the data in csdb format using 7.7, I am using 8.0.1 to export the data from csdb to SPSS without using the replace function. In this case the new line character("\n") automatically replaced by a question mark(?), and all the data is exported without any issue.
thanks.
a.
After getting the data in csdb format using 7.7, I am using 8.0.1 to export the data from csdb to SPSS without using the replace function. In this case the new line character("\n") automatically replaced by a question mark(?), and all the data is exported without any issue.
thanks.
a.
-
- Posts: 1845
- Joined: December 5th, 2011, 11:27 pm
- Location: Washington, DC
Re: How to remove \n from the text field
Escape sequences like \n are only supported using the logic version introduced in CSPro 8.0. See more here:
https://www.csprousers.org/help/CSPro/s ... erals.html
So if you're trying to replace "\n" using the old logic version, that string is not actually a newline character, but is instead a backslash character and n ("\\n" in the new logic version).
Basically if you want to manipulate any string with newlines, you'll have to use the new logic version.
You can read more about newlines here: https://www.csprousers.org/help/CSPro/n ... dling.html
https://www.csprousers.org/help/CSPro/s ... erals.html
So if you're trying to replace "\n" using the old logic version, that string is not actually a newline character, but is instead a backslash character and n ("\\n" in the new logic version).
Basically if you want to manipulate any string with newlines, you'll have to use the new logic version.
You can read more about newlines here: https://www.csprousers.org/help/CSPro/n ... dling.html
-
- Posts: 606
- Joined: July 9th, 2012, 11:32 am
- Location: Islamabad, Pakistan
Re: How to remove \n from the text field
Thank you.
A.
A.