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

My SAS code "a.sas" is in Desktop.

data have;
input code :$5. country $13.;
cards;
USA	United States
;

proc print;
run;

This code standalone prints the following.

                  Obs    code       country

                   1     USA     United States

Another SAS code "b.sas" %INCLUDEs the "a.sas" code as follows.

%include "!userprofile\desktop\a.sas";

And the results are inconsistent.

                    Obs    code     country

                     1     USA	U    States

It seems this difference is related to the tab in between "USA" and "United States" but unclear. I read Rule for Using %INCLUDE in %INCLUDE Statement but I couldn't find the relevant—spacing versus tabbing—issues. What's the reason for this difference?

1 ACCEPTED SOLUTION

Accepted Solutions
Tom
Super User Tom
Super User

SAS DIsplay Manager tries to help you out by fixing your mistake of embedding tabs in your data when it submits the code to run.

You can use the EXPANDTABS option on an infile statement to fix it yourself.

data have;
  infile cards expandtabs;
  input code :$5. country $13.;
cards;
USA	United States
;

Or better still just stop putting tab characters into your program files.

 

 

View solution in original post

2 REPLIES 2
Tom
Super User Tom
Super User

SAS DIsplay Manager tries to help you out by fixing your mistake of embedding tabs in your data when it submits the code to run.

You can use the EXPANDTABS option on an infile statement to fix it yourself.

data have;
  infile cards expandtabs;
  input code :$5. country $13.;
cards;
USA	United States
;

Or better still just stop putting tab characters into your program files.

 

 

Junyong
Pyrite | Level 9

Thanks for this help. Just to make sure, may I ask slightly more? The standalone code runs as I intend even without EXPANDTABS, while %INCLUDE requires EXPANDTABS to do so—which I didn't anticipate beforehand.

(1) Why do they—standalone versus %INCLUDE—behave differently here? Shouldn't their results be identical?

(2) If not, is there any similar %INCLUDE-specific difference? Because I didn't expect their difference so far, I didn't seriously consider these issues (such as tabbing or spacing) as well when coding. Probably I would have to review again to avoid unwanted errors.

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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