Hi there, I am working on a macro, which is used to drop all variables with suffix "_dup". Now the problem is, how to put all variable names into this macro, since I have over 400 variables in this data set? Any ideas? Thanks in advance!
... View more
I want to check if there's a certain variable named "ABC" in the input data set. I can realize it using the following data step: data want; set have; dsid=open('have'); check=varnum(dsid,'ABC'); run; I will check 'check' and use it for further programming. Now I want to realize the same function using a macro. I have tried the following but it didn't work. %macro test(&input); data want; set &input; dsid=open('&input'); *The problem might be here; check=varnum(dsid,'ABC'); run; %mend; %test(xxxx) Does anyone offer some help? Thank you so much!
... View more
Hi there, I have a data set as the picture shows below. For variable R, it has a lot of missing values. What I want to do is to assign the existing value to all the previous blanks. For example, assign 1.0219 to observation 1-10 of R, and assign 0.9598 to observations 12 to 20. Finally the variable R will have 0 missing values. Any ideas? TIA! A
... View more
If the data set contains only these two variables, I would do it like this: *step 1. Delete the first row; data output1; set input; if first.no then delete; rename no=new_no; run; *step 2. Build new variable; data output2; set ouput1; no=lag(new_no); run; Then deal with the first obs of no and last obs of new_no. HTH!
... View more