I had observations that each and every observations will repeat 5 times in simple program. suggest me any one.
data Ex001;
input Name $ Designee $ 20-32 Department $;
datalines;
Madhu Jr_Associate QA
Sathwik Jr_Associate PB
Mohan Manager PB
Raja Manager QA
Kiran Manager BI
Sainath Manager CL
;
run;
Proc print data = Ex001;
run;
Which i want out put
When putting test data in a datastep like that, ensure the data and the datalines statement all appear left aligned, otherwise you may get issues as SAS reads from position one on each row (you will note how you are putting positional reading in there as well, not a good idea). Also, avoid using tab characters in code, these render differently between operating systems/tools. Use spaces to indent, you can setup SAS to use spaces when pressing tabs - in base SAS it is under the options (spaces always render as 1 character regardless of os/tool, where tabs are different).
data ex001; input name $ designee $ department $; datalines; Madhu Jr_Associate QA Sathwik Jr_Associate PB Mohan Manager PB Raja Manager QA Kiran Manager BI Sainath Manager CL ; run; data want (drop=i); set ex001; do i=1 to 5; output; end; run;
When putting test data in a datastep like that, ensure the data and the datalines statement all appear left aligned, otherwise you may get issues as SAS reads from position one on each row (you will note how you are putting positional reading in there as well, not a good idea). Also, avoid using tab characters in code, these render differently between operating systems/tools. Use spaces to indent, you can setup SAS to use spaces when pressing tabs - in base SAS it is under the options (spaces always render as 1 character regardless of os/tool, where tabs are different).
data ex001; input name $ designee $ department $; datalines; Madhu Jr_Associate QA Sathwik Jr_Associate PB Mohan Manager PB Raja Manager QA Kiran Manager BI Sainath Manager CL ; run; data want (drop=i); set ex001; do i=1 to 5; output; end; run;
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.