BookmarkSubscribeRSS Feed
nana_confused
Calcite | Level 5

 

DATA CoImpt.disabilities;
INFILE "/home/u63555769/Project/Data/1_Source/disabilities.txt" delimiter ='&' ;
INPUT tract_fips $10.
pctn_disability :$4.;
run;

The tract_fips and disability  appeared as the first observation. It suppose to be the header. Any suggestion.

 

Thank you in advance for your help

2 REPLIES 2
Tom
Super User Tom
Super User

If you don't want to read the first line of the text file then use FIRSTOBS=2 option on the INFILE statement.

 

Also do NOT use formatted mode input for the first variable.  Use LIST MODE like you did for the second variable.  Add the : modifier in front of both informats.

data CoImpt.disabilities;
  infile "/home/u63555769/Project/Data/1_Source/disabilities.txt" dlm='&' firstobs=2;
  input tract_fips :$10. pctn_disability :$4.;
run;

Or remove the informats and DEFINE the variable before using them in the INPUT statement.

data CoImpt.disabilities;
  infile "/home/u63555769/Project/Data/1_Source/disabilities.txt" dlm='&' firstobs=2;
  length tract_fips $10 pctn_disability $4;
  input tract_fips pctn_disability ;
run;
nana_confused
Calcite | Level 5

Thank you so much. The issue with the code it resolved now.

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!

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
  • 2 replies
  • 314 views
  • 0 likes
  • 2 in conversation