BookmarkSubscribeRSS Feed
R_Win
Calcite | Level 5
i have dataset with delimiter in beetween the observations i want all the delimiters should be replaced with comma.

data c;
input id$ sal$;
if id ='%' then id=',';
cards;
kool-% ra/,'l
nani(^/ mo-'
run;
proc print;
run;


output should be like this
kool,, ra,,,,
nani,,, mo,,
3 REPLIES 3
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
SAS PROC IMPORT and EXPORT may be suitable for your requirements.

As well, you may find that the DATA step approach will work, as you have described in your forum post. For a DATA step approach, you can use the DLM= option on both the INFILE (also include the DSD parameter) and the FILE statements, along with the INPUT and PUT statements to read in and out your file.

The SAS support website http://support.sas.com/ contains product documentation and supplemental technical user community (SUGI / SGF) papers with examples on this topic. I used the site's SEARCH facility and found one technote referenced below for the inputting perspective. Have a look at the SAS Base Language Reference: Dictionary for using the FILE statement for the output perspective.

Scott Barry
SBBWorks, Inc.


http://support.sas.com/techsup/technote/ts673.html
R_Win
Calcite | Level 5
can any one help me inthis
Patrick
Opal | Level 21
Use the function 'translate()' for your ID variable.
If you don't know all possible special characters then a more generic solution would be possible using Regular Expressions - but it's also more difficult to code...
HTH
Patrick

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 635 views
  • 0 likes
  • 3 in conversation