BookmarkSubscribeRSS Feed
JinZhou
Calcite | Level 5

Under Enterprise Guide 7.11 (7.100.1.2711) 64 bit, with WIndows 7 SP1.

 

I'm using the following sas macro:

 

%macro a(factor)

data input;

informat &factor._C best12.;

set input;

&factor_C=&factor;

run;

 

proc univariate data=input;

var &factor._C;

histogram &factor._C/normal(noprint) cbarline=grey;

run;

%mend;

 

It worked properly, but in the log, it returns me the error with the wrong column (compared to the original dataset input).

 

Ex: 

 

the observation's column was 257 (which has the issue), but the log of the macro returns my column 27 (which doesn't have an issue).

 

So, why does this macro change the order of my observations? Or does the macro change the order in general?

 

Thank you.

3 REPLIES 3
Kurt_Bremser
Super User

You are inconsistent in your question.

Do ask about the order of the columns, or the order of the observations?

 

Creating a new variable in a statement after the set statement will have this new column appear last within the observations, naming it before the set statement will put it first in the PDV and therefore in the output dataset.

 

A simple data step like yours will not change the order of observations.

JinZhou
Calcite | Level 5

Sorry about the messed up, I'm always a little bit messed up with the rows/columns with the observations/factors.

 

And yes, I'm asking about the rows/observations.

 

I was wondering if this is because of the default ASC/DSC options with the new factors created in the macro?

 

Will this changed the order of my observations?(Since I added one new factors for all observations)

 

Thank you.

 

Jin

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
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
  • 3 replies
  • 1094 views
  • 0 likes
  • 2 in conversation