BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
wlierman
Lapis Lazuli | Level 10

Help from the community would be appreciated.

 

I have four fields in an excel worksheets and 336 rows. I want to read them into my program. The following is the code:

 

Data stgcocxx.prov_types;
infile 'C:\SAS\Prov_type\Prov_Types.xlsx' truncover;
input CDE_PROV_TYPE_PRIM $ DSC_PROV_TYPE $ CDC_PROV_SPEC_PRIM $ DSC_PROV_SPEC $;
run;

 

The resulting log statements follow:

 

NOTE: The infile 'C:\SAS\Prov_type\Prov_Types.xlsx' is:
      Filename=C:\SAS\Prov_type\Prov_Types.xlsx,
      RECFM=V,LRECL=32767,File Size (bytes)=20892,
      Last Modified=18Sep2018:15:27:54,
      Create Time=18Sep2018:13:04:05

NOTE: 1 record was read from the infile 'C:\SAS\Prov_type\Prov_Types.xlsx'.
      The minimum record length was 679.
      The maximum record length was 679.
NOTE: The data set STGCOCXX.PROV_TYPES has 1 observations and 4 variables.
NOTE: Compressing data set STGCOCXX.PROV_TYPES increased size by 100.00 percent.
      Compressed is 2 pages; un-compressed would require 1 pages.
NOTE: DATA statement used (Total process time):
      real time           0.01 seconds
      cpu time            0.01 seconds

 

I see the following in the viewtable:

 

         CDE_PROV_TYPE_PRIM               DSC_PROV_TYPE       CDC_PROV_SPEC_PRIM       DSC_PROV_SPEC

             PKU <carriage return> -              garbage characters                   <blank>                              <blank>

 

Following is what should be in row 1:

 

01Transportation Provider001Air Ambulance

 

Help and insight will be very much appreciated

 

Thank you.

 

Walt L

 

 

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User
You don't use INFILE to read an XLSX file. Use PROC IMPORT instead.

View solution in original post

2 REPLIES 2
Reeza
Super User
You don't use INFILE to read an XLSX file. Use PROC IMPORT instead.
wlierman
Lapis Lazuli | Level 10

Thank you for quick and correct solution, Reeza.

 

WL

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

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

View all other training opportunities.

Discussion stats
  • 2 replies
  • 661 views
  • 2 likes
  • 2 in conversation