- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Posted 03-03-2023 01:31 AM
(806 views)
Hi Guys,
GoodMorning
when we use infile statement to create dataset from extranal data
IF statement works
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
data dsn;
infile "/home/u35263349/sampleinfile.txt" dsd;
Input id name$ sex$ age sal;
where sex='f';
run;
data dsn1;
set dsn;
where sex='f';
run;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Maxim 1!
From the documentation of the WHERE Statement:
Selects observations from SAS data sets that meet a particular condition.
Emphasis by me.
You do not read from a dataset (no SET, MERGE, MODIFY or UPDATE statement).
When you want to filter during reading from an external file, you must use a subsetting IF.