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

Could someone please help me to understand how I could convert the following into PROC SORT then PROC RANK?

 

ROW_NUMBER() OVER (PARTITION BY UNIQUE_ID ORDER BY mem_no desc, drug_id desc, RX_FILL_DT ASC) AS RANK

 

FYI, formats:

alphanumeric:

UNIQUE_ID 

DRUG_ID

 

date:

RX_FILL_DT

 

numeric:

MEM_NO

 

SAS EG v. 7.13

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User
if first.rx_fill_dt_asc ...

I think auto correct deleted the period, there should be a period between. 

 

FIRST. identifies the first in that particular variable group.

View solution in original post

5 REPLIES 5
Reeza
Super User

PROC SORT data=have;

by  mem_no desc descending drug_id  RX_FILL_DT ASC;

run;

 

proc rank data=have;

by < ... >;

 

VAR ...;

run;

 

I'm not sure what variable is being ranked here or if it's just creating a count variable per group. I suspect the latter which would be easier in a data step.

 

data want;
set have;

by <   >;

if first rx_fill_dt_asc then count=0;
count+1;
run;
vanpeltm1785
Obsidian | Level 7
I get this error:

if first rx_fill_dt_asc then count=0;
______________
388
76
ERROR 388-185: Expecting an arithmetic operator.

Reeza
Super User
if first.rx_fill_dt_asc ...

I think auto correct deleted the period, there should be a period between. 

 

FIRST. identifies the first in that particular variable group.

OsiasEduardo
Calcite | Level 5

Good afternoon!
Have you solved the case? I have the same arithmetic overflow problem.

Reeza
Super User

@OsiasEduardo wrote:

Good afternoon!
Have you solved the case? I have the same arithmetic overflow problem.


This post has nothing to do with arithmetic overflow. Please post your question as a new post.

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 5 replies
  • 31864 views
  • 1 like
  • 3 in conversation