BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
dw_sas
SAS Employee

Please provide a PROC CONTENTS and a PROC PRINT (of the first 10 observations) of your new DEBT_DATA data set so we can determine the cause of the problem.

 

Thanks,

DW

Reeza
Super User

@dw_sas was right in his suggestion of how to fix your problem.

 

But you still have a few issues in your code.

 

  • Do not use the same data set name and the SET name. It makes it really hard to debug your code, is confusing and bad practice.
  • data data;
    set data; 
  • You have a year variable which is numeric and represents a year, as 1994, 1995. It is not a SAS date. 
  • For some reason you think you need to loop - SAS does this automatically so it's a single line of code to create your year variable. 
  • %let start=1983;
    %let end=2017;
    
    data data;
    set data;
    format date year4. ;
    date = "01jan&start."d;
    do until (date > "01jan&end."d);
      output data;
      date = intnx('year',date,1);
    end;
    run; 
  • When I imported the data there were some empty rows and columns, I deleted them.

 

I changed the variable name from date to myDate to make the code more clear.

 

See below:

 

delete_time_series.JPG

 

 

 

Reeza
Super User

@Lok07 did this solve your issues?

Lok07
Calcite | Level 5

It works.

Thank you so much.

The problem was in date function when i verified my data i found that the ancient date function create date from 1983 to 2017 but for each debt's value 

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

Multiple Linear Regression in SAS

Learn how to run multiple linear regression models with and without interactions, presented by SAS user Alex Chaplin.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 18 replies
  • 3941 views
  • 3 likes
  • 5 in conversation