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

Hi Community,

I have some records in the output from the following logic that have 'date' in the raw data however appearing in the output as period (.).

 

What would cause such and can you help me please?

Below is my logic

 

Data bal_startdate (rename=(Date=StartDate) drop=Offset_Bal);

set Daily;

by AccNo;

if first.AccNo;

run;

 

Proc Sql;

Create table Day5_bal as

select a.*,

 

b.offset_Bal,

b.date as Day5,

 

case

when b.date is missing then 'N' else 'Y' end as Day5_Flag

From bal_startdate a

left join Daily b on a.AccNo=b.AccNo and b.date=a.StartDate+5;

quit;

 

Kind regards,

1 ACCEPTED SOLUTION

Accepted Solutions
Timbim
Obsidian | Level 7

Thanks VDD.

 

Could you please provide an example on using anydtdte informat in proc sql or data step?

 

Thanks kindly.

View solution in original post

6 REPLIES 6
Tom
Super User Tom
Super User

There will note be a variable named DATE in either of the datasets your code is creating.

What variable are you saying has a missing value?

Can you show example data for that ends up with missing value?

Are you sure your "date" variable has integer values? Since you are using exact equality perhaps some of the values are slightly different and just appear the be same when the format is applied?

 

 

Timbim
Obsidian | Level 7

Hi Tom,

 

Below is an example with the missing date.

 

DateAccountOpenDateAmountOffSetBalDay5Day5_Flag
24-Sep-181234560124-Sep-185700029-Sep-18Y
24-Sep-181234560224-Sep-188000.29-Sep-18Y
24-Sep-181234560324-Sep-184200.29-Sep-18Y
24-Sep-181234560424-Sep-1820000.29-Sep-18Y
24-Sep-181234560524-Sep-186000..N

 

Kind regards

Timbim
Obsidian | Level 7

Thanks VDD.

 

Could you please provide an example on using anydtdte informat in proc sql or data step?

 

Thanks kindly.

Tom
Super User Tom
Super User

I do not understand what that posted table is trying to represent.

 

It does not look like what your program is expecting as input data. 

Your original program is expecting a data set named BAL_STARTDATE with multiple dates per value of ACCNO.

Your example data has only one record per ACCNO.

 

It does not look like what your program appears to be creating as output.  That dataset should have a variable named STARTDATE.

 

 

Kurt_Bremser
Super User

Take the macro from my second footnote and use it to create a data step with datalines from your dataset "daily". Just a sufficient numer of observations to illustrate your issue. This will take care of any ambiguities, as we can then run your code in exactly the same environment that you ran it.

Posting output listings or copies of the tableview are NOT, I repeat NOT, helpful, as we can only see formatted values, and not the raw values underneath it.

The macro will preserve all values and attributes as they are, which is essential for detecting problems.

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 6 replies
  • 4930 views
  • 0 likes
  • 4 in conversation