We are reading a raw file:
111 .
. .
. .
. .
. 222
We need to create a SAS dataset one like this:
ONE
Customer_Id Product_ID
111 222
Write most efficient program.(It should be in single datastep)
Now prepare your Base SAS and
Advance SAS Certification Exams with Online Mock tests: http://exam.sankhyana.com
For training related info kindly mail us at info@sankhyana.com
www.sankhyana.com
data one(drop=customer_id rename=(cust=customer_id));
ReplyDeleteretain customer_id cust;
infile "C:\..\..\test1.dat" end=last;
input customer_id Product_ID ;
if customer_id >. then cust= customer_id;
if last then output;
run;
proc print;
run;
Even smaller step:
ReplyDeletedata one;
input #1 customer_id
#5 @5 Product_ID ;
output;
datalines;
111 .
. .
. .
. .
. 222
;
run;
Thanks a lot Neo..
ReplyDeletedata one;
ReplyDeleteinfile cards ;
input a b ;
if a='.' then a=111;
if b='.' then b=222;
put _all_;
cards;
111 .
. .
. .
. 222
;
run;
proc print data=one (obs=1);
run;
we can use coleasc funbction to this like
ReplyDeleteb=coleasc(b)
Thank you for taking the time to provide us with your valuable information. We strive to provide our candidates with excellent care
ReplyDeletehttp://chennaitraining.in/qliksense-training-in-chennai/
http://chennaitraining.in/pentaho-training-in-chennai/
http://chennaitraining.in/machine-learning-training-in-chennai/
http://chennaitraining.in/artificial-intelligence-training-in-chennai/
http://chennaitraining.in/snaplogic-training-in-chennai/
http://chennaitraining.in/snowflake-training-in-chennai/