BookmarkSubscribeRSS Feed
swatiN
Calcite | Level 5

HI,

How do I import this .txt into SAS with no titles using infile statement?

i.e I don't want ' INFORMATION ABOUT DEPTNO:10' & 'ENAME JOB SAL DEPTNO' into SAS dataset (i need only the observations)

Thanxs

 

INFORMATION ABOUT DEPTNO:10
'
ENAME JOB SAL DEPTNO
MILLER CLERK 2200.00 10
CLARK MANAGER 3350.00 10

'
INFORMATION ABOUT DEPTNO:20
'
ENAME JOB SAL DEPTNO
FORD ANALYST 4650.00 20
SCOTT ANALYST 4400.00 20

INFORMATION ABOUT DEPTNO:30
'
ENAME JOB SAL DEPTNO
JAMES CLERK 1587.50 30
BLAKE MANAGER 3962.50 30

4 REPLIES 4
Patrick
Opal | Level 21

If the link @Reeza shared doesn't provide you enough guidance then please post an exact sample of your source data as a .txt attachment - or at least post it into a text window using the {i} icon here. Reason: Ensure that we get the exact layout without the forum pages altering anything. 

 

Also ensure that the sample data covers all possible cases. I.e. Is it possible that a source string for ENAME is made-up of more than one word like A. MILLER or MAC MILLER

Ksharp
Super User
data have;
infile cards truncover ;
input @;
if _infile_ in: (" " "'" "INFORMATION" "ENAME") then delete;
else input ENAME : $40. JOB : $40. SAL DEPTNO ;
cards;
INFORMATION ABOUT DEPTNO:10
'
ENAME JOB SAL DEPTNO
MILLER CLERK 2200.00 10
CLARK MANAGER 3350.00 10

'
INFORMATION ABOUT DEPTNO:20
'
ENAME JOB SAL DEPTNO
FORD ANALYST 4650.00 20
SCOTT ANALYST 4400.00 20

INFORMATION ABOUT DEPTNO:30
'
ENAME JOB SAL DEPTNO
JAMES CLERK 1587.50 30
BLAKE MANAGER 3962.50 30
;
proc print;run;
swatiN
Calcite | Level 5

Thank you so much for this info.

I really appreciate it.

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

Mastering the WHERE Clause in PROC SQL

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.

Discussion stats
  • 4 replies
  • 521 views
  • 0 likes
  • 4 in conversation