BookmarkSubscribeRSS Feed
SASPhile
Quartz | Level 8

I tried the following to resolve the three keyword parameters libname, dname and ordby.

 

so libname is passed &source is where the dataset(dname) events is present,I want to sort them in the order age,event_name,event_date.

I;m getting the following error:

ERROR: All positional parameters must precede keyword parameters.

MLOGIC(DERIVE_SEQNUM): Ending execution.

180: LINE and COLUMN cannot be determined.

NOTE: NOSPOOL is on. Rerunning with OPTION SPOOL might allow recovery of the LINE and COLUMN

where the error has occurred.

ERROR 180-322: Statement is not valid or it is used out of proper order.

 

%macro derive_seqnum(libname=,dname=,ordby=);

proc sql;

create table &dname. as

select *

from &libname..&dname.

order by &ordby.

quit;

%mend derive_seqnum;

%derive_seqnum(libname=&source,dname=events,ordby=age,event_name,event_date);

 

2 REPLIES 2
Reeza
Super User

ordby=age,event_name,event_date -> this is your issue.

 

The answer (from a decade ago) is here:

http://support.sas.com/kb/31/012.html

 

RW9
Diamond | Level 26 RW9
Diamond | Level 26

Sorry, its not entirely clear to me what this code is even to achieve?  It seems like you could simplfiy this down to:

proc sort data=&source..events;
  by age event_name event_date;
run;

The rest of it is just wasted characters.  Then you "could" - although I see no benefit and lots of pitfalls - of macro'ing the code;

%macro Do_Sort (lib=,mem=,ord=);
proc sort data=&lib..&mem.; by &ord.; run;
%mend Do_Sort;

%Do_Sort (lib=&source.,mem=events,ord=age event_name event_date);

 

 

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