HI,
Name F1 F2 F3 F4 F5 F6 .. . ..
1Cycle 34 35 23 23 12 89
2Cycle 78 90 78 57 45 67
3Cycle 67 87 45 43 89 64
.
.
.
10cycle 56 45 79 90 45 78
I am having a data set like above which has a whole month data(here I have just spcified 7 columns)
I want to retrive 3rd row data which is fixed and column will be chnaging on the day basis and after retriving the value, assign the value into
a macro variable.
for ex on 4th feb it should select (row 3 and F4 column)=value should give 43
on the 24th feb (row 3 and F24 column)
Let me know if i am not enough clear.
Thanks
Sudtej
Not sure if this is what you want. Following code will put the value of the third row, column(days) you choose into macro variable 'want'.
data have;
input Name $ F1 F2 F3 F4 F5 F6 ;
cards;
1Cycle 34 35 23 23 12 89
2Cycle 78 90 78 57 45 67
3Cycle 67 87 45 43 89 64
;
%macro test (d=);
data _null_;
n=3;
set have point=n;
call symput ('want',f&d);
stop;
run;
%put &want;
%mend;
%test (d=6)
Edit:
For more general purpose, the code can also be slightly tweaked like the following, so you can also choose the row of your will.
%macro test (r= ,c=);
data _null_;
n=&r;
set have point=n;
call symput ('want',f&c);
stop;
run;
%put &want;
%mend;
%test (r=2, c=3)
Regards,
Haikuo
How is the code supposed to know that February is represented on the 3rd record? What do records one and two represent? Do you just want to indicate the date upfront and have the code take care of everything else?
Thanks. It works!
The whole table is for February, its one of the sheets of a workbook. The records 1, 2, 3 are different types of data which i receive on that particular day. So, I just modified your code to take the date as input & code is taking care of everything.
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.
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.