Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Long Integer data type from delimited file was not imported/filled in

Status
Not open for further replies.

iren

Technical User
Mar 8, 2005
106
US
Hi Everybody!

I am trying directly to import from tilde delimited source file to SAS 9.1.

Data Dictionary defines 1st field as char(1) and the next field as a long integer.
After I ran my code I found out that SUMMARY_TYPE_NM field was populated while the next
field END_PERIOD_ID which is numeric was not filled at all. Data in the next one should have looked like 200801

I have no idea what I am doing wrong. How can I fix it? Could you please give me a hand?

Thank you in advance

Iren


1 data IP;
2 infile 'p:\Ir\temp\ip\200801_IP.txt'
3 delimiter = '~' MISSOVER DSD lrecl=32767 firstobs=3;
4
5 informat SUMMARY_TYPE_NM $1. END_PERIOD_ID ;
6
7
8 format SUMMARY_TYPE_NM $1. END_PERIOD_ID ;
9
10
11 input SUMMARY_TYPE_NM $1 END_PERIOD_ID ;
12
13 obsnum + 1;
14 run;

NOTE: The infile 'p:\Ir\temp\ip\200801_IP.txt' is:
File Name=p:\Ir\temp\ip\200801_IP.txt,
RECFM=V,LRECL=32767

NOTE: 105571 records were read from the infile
'p:\Ir\temp\ip\200801_IP.txt'.
The minimum record length was 183.
The maximum record length was 374.
NOTE: The data set WORK.IP_RAG has 105571 observations and 3 variables.
NOTE: DATA statement used (Total process time):
real time 17.20 seconds
cpu time 2.00 seconds



 
Your informat, format and input statements all tell SAS what SUMMARY_TYPE_NM is, but doesn't define END_PERIOD_ID at all.

I'd try this:-
Code:
Data IP;
    infile 'p:\Ir\temp\ip\200801_IP.txt'
    delimiter = '~' MISSOVER DSD lrecl=32767 firstobs=3;

    length summary_type_nm  $1
           end_period_id 8;
    input   SUMMARY_TYPE_NM 
            END_PERIOD_ID ;

   obsnum + 1;
run;
If that doesn't work, append the first 5 lines of the file to your question, it might be an issue with the data.


Chris
Business Analyst, Code Monkey, Data Wrangler.
SAS Guru.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top