11-15-2014 12:24 PM
How do you use ARRAY (using a loop) to accomplish the following:
student_id fund1 fund2 fund3 fund4 fund5 fund6 fund7
120102 1011 1190 1228
120104 1040 1125 1186 1124 1085 1044 1091
120105 1053 1220 1185 1112 1056 1199 1183
to reflect an output as such:
student_id i fund_code
120101 1 1101
120102 1 1011
120102 2 1190
120102 3 1228
120105 1 1130
Thank you for your assistance.
11-15-2014 12:49 PM
Basically the same suggested code as Tom's, but you can use a wild card to define the variables going into the array:
data want (keep=student_id i fund_code);
array funds(*) fund:;
do i=1 to dim(funds);
if not missing(funds(i)) then do;
11-15-2014 02:33 PM
Tom and Arthur,
Thank you very much. I got wrapped around an array with a DO UNTIL loop but I was also struggling with the ability to do what you illustrated above, "funds(i)." This will help me move forward.
Based on other posts it appears that I can say you (Tom and Arthur) are pretty well versed in SAS programming language. This may not be the best venue to ask but I'll do it anyway, assuming you've taken the Base SAS Certification, what are the best resource to prepare for this cert?
Thank you all,
11-15-2014 03:30 PM
I'd ask that question as a new discussion so that you can get feedback from everyone on the forum.
I've been using SAS for over 40 years, but never bothered to take any of the certification exams. That isn't to say that it isn't useful but, after my PhD, I swore off any and all additional tests and certifications.