Hi Good day!
I am trying to stack 26 columns into one column in sas enterprise guide....and its ending up with the error "THE ID VALUE 'STACKEDVALUES' OCCURS TWICE IN THE INPUT DATA SET".I wanted the repeated values as present in the data base (don't want to elminate the duplicates).
Any help ....
for example :
mem_id type_1 type_2
a001 x a
a002 y b
a003 z c
and stack expecting like
mem_id name type
a001 type_1 x
a001 type_2 a
a002 type_1 y
a002 type_2 b
a003 type_1 z
a003 type_1 c
Please describe in considerable detail exactly how you are attempting to stack things. Code generated would be best.
You might also have to show some example of your current data and what you want it to look like afterwards.
Are you attempting to put multiple values into a single variable of one observation or create additional observations, one per variable?
It is easy for coding. data have; input (mem_id type_1 type_2) ($); cards; a001 x a a002 y b a003 z c ; run; data want; set have; array x{*} $ type_:; do i=1 to dim(x); name=vname(x{i});type=x{i};output; end; drop i type_:; run;
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!
What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.
Find more tutorials on the SAS Users YouTube channel.