BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Phoebelee
Fluorite | Level 6

Hey everyone!

 

I am trying to import a dataset downloaded from California Health and Human Services website, in csv format. The file has about 893 rows and 5 columns. I want to import the file and build a dataset, so that I can do further research. But the log keeps showing that my sas cannot read the file.("0 records were read from the infile"), and I don't know how to fix that. so Here is the i am using:

 

DATA ETHINICITY;
INFILE 'C:\Users\Administrator\Downloads\Violent_Crime_Rate_California_2006-2010.csv'

lrecl=32767 missover pad;
RUN;

 

Here is the log:

The infile 'C:\Users\Administrator\Downloads\Violent_Crime_Rate_California_2006-2010.csv'
is:
Filename=C:\Users\Administrator\Downloads\Violent_Crime_Rate_California_2006-2010.csv,
RECFM=V,LRECL=32767,File Size (bytes)=1319201,
Last Modified=23Apr2017:22:22:13,
Create Time=23Apr2017:22:22:12

NOTE: 0 records were read from the infile
'C:\Users\Administrator\Downloads\Violent_Crime_Rate_California_2006-2010.csv'.
NOTE: The data set WORK.ETHINICITY has 1 observations and 0 variables.

1 ACCEPTED SOLUTION

Accepted Solutions
art297
Opal | Level 21

Also, the file ;you attached isn't the same on you specified on the infile statement. Assuming the file you attached is the correct one, and that it's in the same location as the other file you specified, the following should work:

 

DATA ETHINICITY;
  INFILE 'C:\Users\Administrator\Downloads\Physicians_and_Surgeons_by_Race_Ethnicity_and_Practice_Location.csv'
    dlm=',' lrecl=32767 missover firstobs=2 pad;
  informat Primary_Practice_County $14.;
  informat Race_Ethnicity $36.;
  input Month $ Year Primary_Practice_County Race_Ethnicity Count_of_Licensees;
RUN;

Art, CEO, AnalystFinder.com

View solution in original post

3 REPLIES 3
art297
Opal | Level 21

You don't have an input statement specifying the variables to input.

 

I didn't look at the file but, if it has a header row (i.e., a row with the variable names), you might find it easier to use proc import.

 

Art, CEO, AnalystFinder.com

 

art297
Opal | Level 21

Also, the file ;you attached isn't the same on you specified on the infile statement. Assuming the file you attached is the correct one, and that it's in the same location as the other file you specified, the following should work:

 

DATA ETHINICITY;
  INFILE 'C:\Users\Administrator\Downloads\Physicians_and_Surgeons_by_Race_Ethnicity_and_Practice_Location.csv'
    dlm=',' lrecl=32767 missover firstobs=2 pad;
  informat Primary_Practice_County $14.;
  informat Race_Ethnicity $36.;
  input Month $ Year Primary_Practice_County Race_Ethnicity Count_of_Licensees;
RUN;

Art, CEO, AnalystFinder.com

Phoebelee
Fluorite | Level 6
Thank you so much! I do attach a wrong file, and I should have checked it carefully, but it perfectly solved my problem!

SAS INNOVATE 2024

Innovate_SAS_Blue.png

Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

Get the $99 certification deal.jpg

 

 

Back in the Classroom!

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

View all other training opportunities.

Discussion stats
  • 3 replies
  • 2329 views
  • 1 like
  • 2 in conversation