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

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!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

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