BookmarkSubscribeRSS Feed
BrahmanandaRao
Lapis Lazuli | Level 10
data where_infile;
infile'/home/u35263349/My_Folder/class_ds.txt';
input Name$  Sex$  Age Height Weight ;
if Sex='F'; 
run;

Here i am import sashelp.class txt file  and filter with if Clause 

where cannot work with infile statement 

but i didn't get output even if using IF statement where went work

 

 

3 REPLIES 3
ballardw
Super User

@BrahmanandaRao wrote:
data where_infile;
infile'/home/u35263349/My_Folder/class_ds.txt';
input Name$  Sex$  Age Height Weight ;
if Sex='F'; 
run;

Here i am import sashelp.class txt file  and filter with if Clause 

where cannot work with infile statement 

but i didn't get output even if using IF statement where went work

 

 


Show the log that was created when the code ran.

Always when output was not as expected.

Copy the text from the LOG and paste into a text box opened on the forum with the </> icon.

 

Sajid01
Meteorite | Level 14

Hello @BrahmanandaRao 
It is possible that the columns are tab separated. Other wise Your code code should work. If it is indeed tab separated use the following modification

data where_infile;
infile'/home/u35263349/My_Folder/class_ds.txt' dlm ='09'x dsd missover;
input Name $  Sex $  Age Height Weight ;
if Sex='F'; 
run;

 

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 563 views
  • 1 like
  • 4 in conversation