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-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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.

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
  • 3 replies
  • 838 views
  • 0 likes
  • 2 in conversation