HI
my table looks like this
id. Total. number. Starttime1. End time1. Dur. Number. Starttime2 endtime2. Dur2
everything is group by id
what at I want to do is show the starttime1 is on same day as an starttime2 currently it brings in every incident for the month for example
06/01/15. And thN 06/04/15
here is what I have
data report6 (drop=I n Mac st et dh);
retain id total machine1 starttime1 endtime1 dur &allvar.n;
format &Mac. $10. &St. &et. Datetime.;
set want3(rename=(machine2=Mac starttime2=st endtime2=et dur2=Dh));
by id number1;
array m(*) &emac.;
array s(*) &st.;
array e(*) &et.;
array d(*)&dh.;
if first .id or first.number1 then
do: n=0
do i=1 to &mx.;
m(I) ="" ; s(I)=.; e(I)=. ; d(I)=.;
end;
end;
n+1 ;
m(n)=Mac;
s(n)=st;
e(n)=et;
d(n)=dh;
if last.id or last.number1 then output report6;
run;
Please show some input values and the desired output.
I Have data that looks like this
what I am doing is looking Inot a location that have more than one machine...than look into when the first one was brought down an 2nd one was brought down... If the time crosses an any givin time they are both down I Id that.... Up to this point it all works lol... When it's a daily pull report completes when I increase the date range it starts combing by id no matter the date for example
NEed
id. Number. Date. Number 2. Date2
1. A1. 06/01/15. a2. 06/01/15
2. B1. 06/02/15
2. D1. 06/03/15
1 A1. 06/02/15. A2. 06/02/15
what I get
id number. Date Number2. Date 2. Number3. Date3. Number 4. Date4
1. A1. 06/01/15. a2 06/01/25. a1. 06/02/15. A2. 06/02/15
so what I see that is happening its grouping it by id no matter the date ... Thank you
I still can't tell what your desired output is.
Those macro variables not being defined doesn't help. Did you have some that worked before you started adding in macro variables?
The result looks sort of like a transpose from narrow to wider.
If this is supposed to be the desired output:
1 A1. 06/02/15. A2. 06/02/15
Where did A2 get a date of 06/02/15? It doesn't appear to be associated with that date in the example data.
I am not sure exactly what your "Number" variable means but it seems that it may mean 2 pieces of information Location and machine number in that location perhaps? If that is the case you would be better off having two variables.
It may not help that case is inconsistent also: A1 a1 a2 and A2. "A1" is not equal to "a1".
Also you describe your data in the first post as consisting of :
id. Total. number. Starttime1. End time1. Dur. Number. Starttime2 endtime2. Dur2
but then post example data of
id. Number. Date. Number 2. Date2
what happened?
HI ballardw
i might need to approach differ could you show me how to create a macro that runs for everyday then I will append it ...currently I have a
data _null_ ; start_date = today ();
call symput ('dt', " ' " ||put (start_date-20,yymmdd10.)||" ' ");
call symput (dt1', " ' " ||put (start_date-3,yymmdd10.)||" ' ");
run;
im using a between &Dt. And &dt1
how can I set up a Marco where it runs every day as individua day instead of pulling it all at once ? Thanks for the help
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!
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.
Ready to level-up your skills? Choose your own adventure.