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.
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;
P.S. The Smiley isn't really a Smiley, but "Drop= :_ )".
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.
Hello,
Have you considered the "LAG" function in SAS ? This should help with time series data...
Good luck...!!!
Another paper thought might help is attached.
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;
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.