10-09-2017 05:03 AM - edited 10-09-2017 05:29 AM
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.
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.
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
10-12-2017 05:41 AM
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
10-13-2017 12:54 AM
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.