Background: I have one row record.
and the expexted result is as follow:
Is there ant methods to perform it efficiently in SAS DI?
As I have tried using transpose transformation and it just allows me to transpose one column to one output column each time, i.e, I need to perform the transformation 2 times to achieve the above results.
Post test data in the form of a datastep in a code window (its the {i} above post area). At a guess:
data have; x1="a"; x2="b"; x3="c"; x4="d"; run; data want (keep=want:); set have; array vals{4} x:; do i=1 to 4 by 2; want1=vals{i}; want2=vals{i+1}; output; end; run;
Sorry I am using sas di tools not sas code
I would try SAS/IML. Would you like IML code ?
data want (drop = i);
do i = 1 to 2;
input name $ @;
input name1 $ @;
output;
end;
cards;
a b c d
;
run;
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
Need to connect to databases in SAS Viya? SAS’ David Ghan shows you two methods – via SAS/ACCESS LIBNAME and SAS Data Connector SASLIBS – in this video.
Find more tutorials on the SAS Users YouTube channel.