@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.
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: