BookmarkSubscribeRSS Feed
arpit
Calcite | Level 5
I have a raw dat like

ram "history,math geography"
hari "physics,, math chemistry"

I want to create a data set like

history math geography
physics math chemistry Message was edited by: arpit
3 REPLIES 3
art297
Opal | Level 21
Would something like the following suffice?:

data want (drop=i classes);
informat classes $30.;
array class(3) $10.;
input name $ classes &;
classes=compress(classes,'"');
do i=1 to 3;
class(i)=scan(classes,i);
end;
cards;
ram "history,math geography"
hari "physics,, math chemistry"
;
run;

HTH,
Art
---------
> I have a raw dat like
>
> ram "history,math geography"
> ari "physics,, math chemistry"
>
> I want to create a data set like
>
> history math geography
> physics math chemistry
>
> Message was edited by: arpit
Ksharp
Super User
How about this:
[pre]
data want(drop=row);
infile "c:\rawdata.txt" length=len;
input row $varying200. len;
want_row=compbl(translate(scan(row,2,'"'),' ',','));
run;
[/pre]

Ksharp
R_Win
Calcite | Level 5
data l;
input name $ classes $40.;
classes=compress(classes,'"');
c1=scan(classes,1);
c2=scan(classes,2);
c3=scan(classes,3);
cards;
ram "history,math geography"
hari "physics,, math chemistry"
run;

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 730 views
  • 0 likes
  • 4 in conversation