Try the COMPRESS() function with the S modifier. However, if you have spaces in the path those will also disappear.
var = compress(var, , 's');
If you need to remove only carriage returns you can try the following where '0x0D'x is the hex code for a carriage return/line wrap.
var_clean = compress(var, '0x0D'x)
@Vimal08 wrote:
Hi Team, I have a column where output is a string that looks like a path (/home/sas/demo/data). But the value is getting wrapped and the output is coming like this: /home/sas/ demo/data Please help me, how I can unwrap this string in the output? and get the desire output (/home/sas/demo/data). Your help will be highly appreciated.
@Vimal08 wrote:
Hi Team, I have a column where output is a string that looks like a path (/home/sas/demo/data). But the value is getting wrapped and the output is coming like this: /home/sas/ demo/data Please help me, how I can unwrap this string in the output? and get the desire output (/home/sas/demo/data). Your help will be highly appreciated.
What output? What procedure produced the output? What type of destination did you use?
Can you create a simplified example that exhibits the issue?
Either include that data in your example as a SAS data step. Or use one of the existing SASHELP datasets to demonstrate the issue.
Try the COMPRESS() function with the S modifier. However, if you have spaces in the path those will also disappear.
var = compress(var, , 's');
If you need to remove only carriage returns you can try the following where '0x0D'x is the hex code for a carriage return/line wrap.
var_clean = compress(var, '0x0D'x)
@Vimal08 wrote:
Hi Team, I have a column where output is a string that looks like a path (/home/sas/demo/data). But the value is getting wrapped and the output is coming like this: /home/sas/ demo/data Please help me, how I can unwrap this string in the output? and get the desire output (/home/sas/demo/data). Your help will be highly appreciated.
Thank you. It worked.
23 data _null_; 24 c1 = '0D'x; 25 c2 = '0x0D'x ; ERROR: Invalid hexadecimal constant string '0x0D'x. 26 put (c1 c2) (=$hex.); 27 run;
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.