Retain Statement Data Spread over multiple lines SAS -
im having trouble dataset. there free form character variable spread on multiple lines. want put variable new variables each observation on own line
heres example dataset
data have; input ob_ref $ chardata $ linenum 3.; datalines; 321a myname 1 321a john 2 431a myname 1 431a notjohn 2 431a itsfred 3 511a geoff 1 754a cam 1 ;
there ob_ref each observation , have linenum variable indicating how many lines observations data spread over. need new dataset 1 observation per line , character variable spread on multiple variables. maximum linenum 56
any appreciated
i think you're looking this? create array of character variables, use linenum variable assign values correct character variables. output on last row given ob_ref.
data want(keep=ob_ref char1-char56); array _c $ char1-char56; until (last.ob_ref or eof); set have end=eof; ob_ref; _c(linenum)=chardata; end; output; run;
Comments
Post a Comment