@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.
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.