Hello. Is there a way to display a measure as a date in a crosstab in Visual Analytics? I'm not asking about displaying a date as a row or column. I'm asking how to display the crosstab cells (measure) as a date. I see there are numerous formats (comma, currency, dollar, euro, etc.) that can be applied but displaying a number as a date doesn't appear to be one of them. I'm trying to show, in crosstab form, the date an event (column) occurred for an individual (row). I've tried using a normal list for this but the crosstab output is much preferred.
Hi,
I am not quite sure I understand the output desired, by my friend and I have worked out this little code that might be helpful:
data have;
input id date $ 3-13 event ;
mydate = mdy(substr(date, 1,2),substr(date,4,2), substr(date,7,4));
format myDate date9.;
datalines;
1 11/23/2014 0
2 10/23/2014 0
2 11/23/2014 1
1 10/23/2016 1
;
run;
proc print;run;
proc report data = have;
column id event, (mydate);
define id/group;
define event/across;
define myDate/group;
run;
If the values that you want to be displayed as dates are stored in the dataset as numeric, as in the case of my VA dataset, a similar result to your PROC REPORT can be achieved using PROC TABULATE. I just cannot figure out how to do this in Visual Analytics.
data have_num;
input id date event;
datalines;
1 20050 0
2 20019 0
2 20050 1
1 20750 1
;
run;
proc tabulate =have_num format=date11.;
class id event;
table id, event*date*max=' '; /*max used for one date per event*/
var date;
run;
When you say you want to treat the measure as a date, is the measure a number of days?
-------------------------------------------------------------------------
Four tips to remember when you contact SAS Technical Support
Creating Beautiful Reports
SAS Visual Analytics Learning Center
Hello, Madelyn. No, I would like to see the date of an occurrence at the intersection of an individual's ID and an event. The screen shot is the result of Anca's code. However, I need to produce this result in Visual Analytics.
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
See how to use one filter for multiple data sources by mapping your data from SAS’ Alexandria McCall.
Find more tutorials on the SAS Users YouTube channel.