- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
hi there!.
how to print entire content of particular character varible
for example i need to print like " my name is alphapet and place is world " on entire column
- Tags:
- character length
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
The length of a character variable is set the first time the data step meets the variable. Therefore, make sure that the length of the variable is large enough to meet your needs.
As a small example, here:
data test1;
string="abc";output;
string=" my name is alphapet and place is world ";output;
run;
the length of String is three. Therefore the string you want to have in a variable is truncated. Instead, we can make sure the no truncation happens by setting a large enough length like this
data test2;
length string $200;
string="abc";output;
string=" my name is alphapet and place is world ";output;
run;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Post the code you already have, and we can show you where to improve it.
If you read from an external file, include an example for that.
See my footnotes for hints on posting code; use the {i} button to post lines from the external file.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
data breakfast;
length items $20;
length description $85;
infile"/home/naveence0/food.txt" dlm='|';
input items$ price description$ calorieskl;
run;
proc print data = breakfast;
data breakfast;
set breakfast;output;
format price DOLLAR10.2;
;
run;
proc print data= breakfast;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
You can simplify your code by using informats with a colon, and formatting price in the same step:
input items :$20. price description :$85. calorieskl;
format price dollar10.2;
The length statements can now be omitted.