data a;
infile "/home/u35263349/if.txt";
input name$ city$ ;
if city='hyderabad' ;
run;
1.which statement works if statetment or where statement in infile statement read the external source data
please find below attachment txt.file
If you run this code:
data a; infile "/home/u35263349/if.txt"; input name$ city$ ; run;
You will see that the value in the data is read as "hyderaba". The length is 8 characters because when you use Input city $; SAS defaults to reading 8 characters. You need to provide an informat longer than 8 OR tell SAS the variable should be longer. So you did not have the value long enough to match your If condition.
This uses an informat to read City as a 10 character variable:
data a; infile "/home/u35263349/if.txt"; input name$ city :$10. ; run;
This sets the length of Name and City to 10 characters when read:
data a; infile "/home/u35263349/if.txt"; length name city $10; input name$ city $ ; run;
which statement works in infile statement IF or where
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!
SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.
Find more tutorials on the SAS Users YouTube channel.