Hi Tom,
There is no such variable as status/documented in the input dataset. The question asks to order by original datetime value only and there is no any other order by variable. You are right about the order of the observations when ordering by both time and name variables. I tested ordering by both calculated date value and merchant name, the code and result are as follows (the one comes first for 01DEC2018 is Alar Air, Inc, and then Big Burgers, Inc. the second):
proc sql;
select customername label='Customer Name',
merchantname label='MerchantName',
amount label='Transaction Amount'
format=dollar10.2,
datetime,
datepart(datetime) as transactiondate
label='Transaction Date'
format=date9.
from sq.transactionfull
where month(calculated transactiondate)in(11,12) and
service ^= 'University'
order by transactiondate, merchantname;
quit;
When order by original datetime value and merchant name, the one comes first for 01DEC2018 is Sceneit Cinemas, LLC again (this confirms that the earliest transaction occurred on 01DEC2018 was Sceneit Cinemas, LLC, btw):
proc sql;
select customername label='Customer Name',
merchantname label='MerchantName',
amount label='Transaction Amount'
format=dollar10.2,
datetime,
datepart(datetime) as transactiondate
label='Transaction Date'
format=date9.
from sq.transactionfull
where month(calculated transactiondate)in(11,12) and
service ^= 'University'
order by datetime, merchantname;
quit;
The code (both my answer and the answer provided by the course note PDF) in my first post exactly reflects the procedures the question asks to follow. I think the steps and procedures were phrased clear and not ambiguous in the question, except the "the first documented transaction" part. It would be better if the question explicitly asks to produce a report that examines what is the merchant name of the earliest transaction happened on 01DEC2018 (without showing the time part of the datetime value and display the date only).
... View more