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-wordmark-2025-midnight.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.


Register now!

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