Hello, I have a file that contains multiple years' worth of survey data. I do not have access to the individual years' files, just the merged file. I'm trying to work out a way to determine which questions (each represented by a variable in the file) were asked during which years. I have tried a few approaches, but haven't had any luck. All I really need at this point is a list of variables and their corresponding years. My most recent attempt involved several nested do loops. For example, just looking at the numeric variables in the file: data modlastyear ;
set modlast;
by syear; *This is the survey year variable;
array allnum(*) _numeric_;
do syear=2000 to syear=2016;
do i=1 to dim(allnum);
if not missing (allnum(i)) then do;
year=syear;
Variable =vname(allnum(i));
output;
end;
end;
end;
run; I am currently using 9.4. Edit: Here are a few lines of data: SAS Output fruit fruit2 FRUIT1 fruitfmt FRUITJU1 fruitjui SYEAR 320 2 . 4 . 306 2000 101 2 . 5 . 203 2000 201 2 . 3 . 102 2000 101 2 . 5 . 202 2000 202 2 . 3 . 203 2000
... View more