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
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;
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.
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;
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.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.