@Rajeshganta wrote:
Thank you it solved my requirement
Then please set the most helpful post as solution.
@Rajeshganta wrote:
How to write a program to repeat a value if x=rajesh for 2 timesthen it has to present as rajesh rajesh
data sample;
have='rajesh';
want=repeat(trim(have)||' ',1);
output;
run;
proc print data=sample;
run;
Without posting any sample data (in usable form) answering question is almost always guesswork. From your initial post i would have answered the very same that @Patrick did. If you want to duplicate observations, you have to use the output-statement.
data want;
set have;
if x = 'rajesh' then output;
output;
run;
Please give an example of your input dataset and what the output should look like.
Does this answer your question ?
data have;
input name $ times;
cards;
Rajesh 2
Howard 3
;
run;
data want;
set have;
do i=1 to times;
output;
end;
keep name;
run;
@Rajeshganta wrote:
Thank you it solved my requirement
Then please set the most helpful post as solution.
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 save with the early bird rate—just $795!
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.