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;

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 1451 views
  • 0 likes
  • 4 in conversation