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.
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 25. Read more here about why you should contribute and what is in it for you!
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.