BookmarkSubscribeRSS Feed
tennis1
Calcite | Level 5

For the target drugs in the GPI column, I’d like to know if an alternative drug (column I)
was filled within 7 days of the target drug reject. 

 

data WORK.MESSAGE;
   infile datalines;
   input fill_date GPI Alt_1 Alt_2 Alt_3 etc.;
 datalines; 
6/1/19 A B C D
6/25/19 E F
5/14/19 G H B C D F Y Z
;
;;;

I can isolate the claims that were rejected, but am not sure how to extract the alternatives within the time frame. Thanks in advance! 

1 REPLY 1
ballardw
Super User

Please show what you expect the result to look like.

 

And please make sure that your data step generates a data set that you expect. What appears to be posted will only have one record. Datalines should not be on the line with "datalines;" as well.

 

You might be able to use WHICHC to find which variable has a value but from the scrambled data step you posted I don't see any likely candidates for the "gpi" to be found.

 

Instructions here: https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-dat... will show how to turn an existing SAS data set into data step code that can be pasted into a forum code box using the {i} icon or attached as text to show exactly what you have and that we can test code against.

sas-innovate-white.png

Our biggest data and AI event of the year.

Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.

Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.

 

Register now!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 1 reply
  • 388 views
  • 0 likes
  • 2 in conversation