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

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