BookmarkSubscribeRSS Feed
Ravikumarkummari
Quartz | Level 8

Hii Good morning.

 

I have  a dataset in that variable are date,documentname, downloads.

the dates are starting from 1st jan2015 to 30sep 2015.

computing each date wise finding the next 100th obseravation.

example                     1st jan2015  doc1234   53

                                  ---------------------------

                                 ----------------------------

                                -----------------------------

after100th day is        4thApr2015  doc1234   87.

 

I want the output like 1st jan2015 Doc1234   53   4thApr2015   87.

this have to done in time series analysis in sas.

 

Any suggessions would be greatly recommended.

6 REPLIES 6
user24feb
Barite | Level 11

I am not sure if I have fully understood what you are after, but I think:

 

Data A (Drop=i);
  Format Date Date9.;
  Do i=1 To 200;
    Date=IntNX('day','01JAN2015'd,i-1,'same');
 Value=Round(Rannor(1)*5+50,1);
 Output;
  End;
Run;

Proc TimeData Data=A Out=_NULL_ OutArray=A (Where=(not Missing(Value2)) Drop=_:);
  ID Date Interval=Day;
  Var Value;
  OutArray Date2 Value2; * I don't think you can insert a date format for Date2 here .. ;
  Do t=1 To _LENGTH_;
    Value2[t]=Value[t-100];
 Date2[t]=Date[t-100];
  End;
Run;

Data A;
  Set A;
  Format Date2 Date9.;
Run;

user24feb
Barite | Level 11

P.S. The Smiley isn't really a Smiley, but "Drop= :_ )".

RW9
Diamond | Level 26 RW9
Diamond | Level 26

Can you post an example of test data in the form of a datastep, and required output.  It really isn't clear from your post what you expect.

kannand
Lapis Lazuli | Level 10

Hello, 

 

Have you considered the "LAG" function in SAS ? This should help with time series data...

 

http://support.sas.com/documentation/cdl/en/etsug/60372/HTML/default/viewer.htm#etsug_tsdata_sect048...

 

Good luck...!!!

Kannan Deivasigamani
kannand
Lapis Lazuli | Level 10

Another paper thought might help is attached.

Kannan Deivasigamani
Steelers_In_DC
Barite | Level 11

If it's not dependent on date and you only want the 100th obs then this should do it:

 

data have;
infile cards dsd;
input field @@;
cards;
.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,
.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,
.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,
.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,
.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.
;

data all want;
set have;
count + 1;
if count = 101 then count = 1;
output all;
if count = 1 then output want;
run;

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
  • 1592 views
  • 0 likes
  • 5 in conversation