Suppose you have imported the xls file into sas successfully. data have;
infile datalines truncover;
input pagenum & $ name $ format $ length start output : $20.;
datalines;
Page 1
. A numeric 8 1 543
. B alpha 13 9 abcdef
. C alpha 13 22 fedgs
. D alphanum 13 35 C012
. E alpha 13 48 rslghdlrfhdsr
. F numeric 8 61 323
. V1 numeric 6 67 110011
Page 2
. G numeric 8 1 8543
. H numeric 8 9 500032
. C alpha 13 17 fedgsrre
. J alphanum 13 30 C014
. K alpha 13 43 ghdlrfhdsrd
. F numeric 8 56 6323
. I alpha 13 64 fkfifffffd
. V2 numeric 7 77 0110011
;
run;
data want(drop=_pagenum);
set have;
length _pagenum uniqueId $ 20;
retain _pagenum;
if not missing(pagenum) then _pagenum=pagenum;
else do;
pagenum=_pagenum;
uniqueId=catx('_',pagenum,name);
output;
end;
run;
data want(drop=i _v);
length _v $ 20;
do until(last.pagenum);
set want;
by pagenum;
end;
_v=output; i=0;
do until(last.pagenum);
set want;
by pagenum;
i+1;
VFlag=char(_v,i);
if not last.pagenum then output;
end;
run;
Ksharp
... View more