Hi Team,
data ds1;
infiledatalines;
input star;
cards;
*
**
***
****
*****
run;
how to create 10000 stars at a time by using sas
Thanks in advance
Please use descriptive subject lines in the future, so others do not need to do that for you. Using just "sas" (sic) in the SAS communities does not shine a positive light on a poster's intelligence.
For your question:
data want (compress=yes);
length stars $32767;
do i_n_= 1 to 10000;
stars = repeat('*',_n_);
output;
end;
run;
Please use descriptive subject lines in the future, so others do not need to do that for you. Using just "sas" (sic) in the SAS communities does not shine a positive light on a poster's intelligence.
For your question:
data want (compress=yes);
length stars $32767;
do i_n_= 1 to 10000;
stars = repeat('*',_n_);
output;
end;
run;
The REPEAT function has a quirk ... it starts with the first string, and then repeats it the number of times in the second parameter. So the first value generated would be ** rather than *. I imagine that a value of 0 for the second parameter is OK, and that the loop should go from 0 to 9999 instead of 1 to 10000.
I must admit that I just know that the function exists, but have never used it. And, to my shame, I did not mention the code is untested (I am on my tablet at the moment while watching NFL Gamepass).
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.