BookmarkSubscribeRSS Feed
septemberbulb
Obsidian | Level 7

Hello,

 

I am a new programmer and hope to get some help.I've already created a table. However, some codes can not be grabed because of the applicationdate not equal to codesdate. So I want to add the blank obs from the previous applicationdate.  I am not quite sure whether can I use proc sql case when like this as below:

 

proc sql;

 create table new as

    select origianl*

              case when codes=' ', then rules.codes where codesdate=min(original.codesdate)

              else original.codes

              end as codes;

quit;

 

whehter can I use other more simple logic for example data; set; My goal is to look back to the rules table where the codedate is min() when the codes are blank and the rest keep their original value. 

 

thank you.

2 REPLIES 2
RW9
Diamond | Level 26 RW9
Diamond | Level 26

Start by posting some test data - in the form of a datastep.  Follow this post if you need to:

https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-dat...

 

Secondly, your SQL statement is invalid in several ways, first you have no "from" clause, second origianl* - is invalid.

Post what you have, and show what you want at the end.  Note you don't necessarily need to use SQL, but its hard to advise on the limited information you have provided.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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