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).
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
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.