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 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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