BookmarkSubscribeRSS Feed
panvart
Calcite | Level 5

Is it possible to create a BarChart in SAS VA which displays number of students discharged and admitted from 1 st Jan 2001 till 1st Jan 2017 irrespective of whether there is any admission or discharge on that day. I am using SAS VA 7.1
 
I have done bar charts for Admission Count and Discharge Count separately but unable to combine two bar charts into one. 

 

I/P Table: 
Student Name      Admit Date        Discharge Date
Student 1                   Date 1           Date 7
Student 2                   Date 2           Date 9
Student 3                   Date 3 
Student 4                   Date 4
Student 5                   Date 5
Student 6                   Date 6
 

How to create/calculate Date(Category) as below which can be used to compare if admission/discharge date equal to it or not.

O/P Table/BarChart:

Date(Category)  Count of Admission       Count of Discharge

01/01/2017                     1                                      0

01/02/2017                     0                                      0

01/03/2017                     3                                      5

... and so on

01/31/2017                     4                                      0

02/01/2017                     0                                      0

... and so on


Thanks

2 REPLIES 2
FalkoSchulz
SAS Employee

I don't think the data structure you have proposed will work unfortunately. The problem is that a bar chart only supports a single category as axis and therefore you will struggle to merge both.

 

Using a simple data step to create a test table - you currently have the following:

 

data students;
infile datalines dsd; 
input student : $9. admit : ddmmyy8. discharge : ddmmyy8.;
format admit date9. discharge date9.;
datalines;
Student 1,01/01/17,01/03/17
Student 2,01/02/17,01/06/17
Student 3,01/03/17,.
Student 4,01/04/17,.
Student 5,01/05/17,.
Student 6,01/06/17,.
;
run;

Are you able to produce the following data structure instead? This transposed structure uses a single data column with separate counts for admit and discharges:

 

data students;
infile datalines dsd; 
input student : $9. date : ddmmyy8. admit discharge;
format date date9.;
datalines;
Student 1,01/01/17,1,0
Student 1,01/03/17,0,1
Student 2,01/02/17,1,0
Student 2,01/06/17,0,1
Student 3,01/03/17,1,0
Student 4,01/04/17,1,0
Student 5,01/05/17,1,0
Student 6,01/06/17,1,0
;
run;

In VA - you should be able to assign the date column as category and add both measures.

 

Hope this helps. Falko

panvart
Calcite | Level 5

Hi Falko,

 

I agree with merging not possible logically and thank you for confirming.

 

I will try to generate data structure as you mentioned using JOIN on dummy dates table or some other way using SQL.

 

I will update you.

 

Thanks a lot.

 

-pankaj

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 2 replies
  • 1144 views
  • 0 likes
  • 2 in conversation