Hi
Here I am trying to data manipulate using do loop
data dsn;
do Sex= 1 to nobs ;
length sex $ 12 ;
set sashelp.class nobs=nobs;
if Sex='F' then Sex='Female';
output;
end;
proc print;
run;
I don't understand what the purpose of the DO loop is in that program. If you want to recode the value used for females just do:
data WANT;
length sex $12 ;
set sashelp.class ;
if Sex='F' then Sex='Female';
run;
@BrahmanandaRao wrote:
I Know if condition so that I just trying do loops I took small dataset suppose if huge data then
The number of observations does not impact the code.
Hi:
If all you want to do is change the display of the variable for PROC PRINT, you can use a user-defined format for that. See #1 below. If you want to create a new character variable, then you can also do that with a user-defined format and the PUT function, no DO Loop or IF statement needed. See #2 example below.
Cynthia
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.