BookmarkSubscribeRSS Feed
ANON4
Obsidian | Level 7

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.

5 REPLIES 5
AncaTilea
Pyrite | Level 9

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;

ANON4
Obsidian | Level 7
Yes, Anca, that is exactly the result I want except I'm trying to get that result in SAS Visual Analytics. Thank you so much for this...I'm sure I can use that bit of code in EG for other projects.

ANON4
Obsidian | Level 7

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;

 

Capture2.PNG

Madelyn_SAS
SAS Super FREQ

When you say you want to treat the measure as a date, is the measure a number of days? 

ANON4
Obsidian | Level 7

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.
Capture.PNG

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

Tips for filtering data sources in SAS Visual Analytics

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.

Discussion stats
  • 5 replies
  • 1038 views
  • 0 likes
  • 3 in conversation