BookmarkSubscribeRSS Feed
sahoositaram555
Pyrite | Level 9

Hi All,

 

I have a dataset like below 

 

Characteristics

G1

G2

OVERALL

ord

 

 

 

 

2

N

xx.xx(xx.xx%)

xx.xx(xx.xx%)

xx.xx(xx.xx%)

2

Mean(SD)

xx.xx(xx.xx%)

xx.xx(xx.xx%)

xx.xx(xx.xx%)

2

Q2(Q1 Q3)

xx.xx(xx.xx%)

xx.xx(xx.xx%)

xx.xx(xx.xx%)

2

 

 

 

 

5

N

xx.xx(xx.xx%)

xx.xx(xx.xx%)

xx.xx(xx.xx%)

5

Mean(SD)

xx.xx(xx.xx%)

xx.xx(xx.xx%)

xx.xx(xx.xx%)

5

Q2(Q1 Q3)

xx.xx(xx.xx%)

xx.xx(xx.xx%)

xx.xx(xx.xx%)

5

 

 

 

 

1

N

xx.xx(xx.xx%)

xx.xx(xx.xx%)

xx.xx(xx.xx%)

1

Mean(SD)

xx.xx(xx.xx%)

xx.xx(xx.xx%)

xx.xx(xx.xx%)

1

Q2(Q1 Q3)

xx.xx(xx.xx%)

xx.xx(xx.xx%)

xx.xx(xx.xx%)

1

 

 

 

 

3

N

xx.xx(xx.xx%)

xx.xx(xx.xx%)

xx.xx(xx.xx%)

3

Mean(SD)

xx.xx(xx.xx%)

xx.xx(xx.xx%)

xx.xx(xx.xx%)

3

Q2(Q1 Q3)

xx.xx(xx.xx%)

xx.xx(xx.xx%)

xx.xx(xx.xx%)

3

 

 

 

 

 

 

Where characteristics rows are blank i would like to put values like age, weight , height ...etc since the table is very big(80 rows). All the results are coming from inidvidual datasets which i have used a set statement like below

 

Data d;

set OUTPUT_: ;  /*here OUTPUT_: is written to get all the data sets sequentially due to the prefix name "OUTPUT_" is common to all. 

run;

 

Kindly share your ideas how this can be done with macro since i have 22 values to fill in to those blank spaces with age,height,weight ...etc. in a sequential manner.

I'm thinking to assign all the variables in a %let statement and then passing them in to the loop , but don't know how exactly this can be done with the help of a do loop. If any thoughts around this , it will be very helpful.

 

Cheers,

Ram    

 

1 REPLY 1
SwissC
Obsidian | Level 7

Would something like this work?

%LET charnam=Age (years)$Weight (kg)$Height (cm)$BMI (kg/m^2);


DATA want;
  SET have;
  DO i=1 TO 4;
    IF ord=i and characteristics="" THEN characteristics=scan("&charnam", i, "$");
  END;
RUN;

You would of course have to make sure the order in the let statement matches the ord var numbering.

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 1 reply
  • 412 views
  • 0 likes
  • 2 in conversation