- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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 ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
That's what would be called a display format, not a storage format.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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 ;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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.