Hi ,
data ds;
input x $ y $ z $;
cards;
ram is agoodboy
;
run;
output:
x y z a
ram is agoodboy ram
is
agoodboy
It is only one observation in the final output.
Anyone can help me how to get this output ?
Please see this post that has the solution to your issue.
https://communities.sas.com/t5/SAS-Programming/Override-space-as-delimiter-in-reading-text-files/td-...
With the above post in mind, your code would be like this.
DATA ds ;
ATTRIB a LENGTH = $200 ;
INFILE datalines TRUNCOVER;
INPUT a $char200.;
datalines;
ram is a good boy
;
RUN ;
If the question is "how do I insert carriage return and/or linefeed characters between values of a single variable the answer would be the CATX function. But the data set viewer won't honor them and they may get treated oddly by different display formats, RTF, PDF, HTML depending on the exact syntax used to display them.
data ds; input x $ y $ z $; a=catx('0D'x,x,y,z); output; cards; ram is agoodboy ; proc print data=ds; var x y z; var a /style=[asis=on]; run;
But if you don't use the style override in Print the variable A appears on one line with spaces between bits.
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
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.