02-07-2013 06:07 PM
Does any one have a macro to generate distribution plots for character variables in a dataset. The distribution should contain N, NMISS for each variable and for each time period. The plot should have date on x-axis and percentage on Y-axis (NMISS percentage for example). I have 269 char variables and I've to plot their distribution. Any help or suggestion would be appreciated.
Thanks in advance!
02-07-2013 06:30 PM
02-11-2013 10:58 AM
Thank you for your response. I need to plot more than missing and non missing distribution. I need to plot missing, and frequency of each value in a variable as stacked plot against time. Cumulative distributive percent is the Y-axis and time is X-axis. Could you or anyone suggest me how to proceed?
02-11-2013 11:39 AM
1. Create a format that creates your non-missing/missing variables
See here how to do the format.
2. Run a proc freq with your character variables against your time variable, applying the format to your 269 variables. You can use the _character_ key word if possible.
3. Plot the results from #2.
Add a step in between 2 and 3, a datastep that calculates the cumulative total over the time.
02-11-2013 04:02 PM
Thanks for your response. I am trying to generate a stacked band plot with my data. but I coudln't generate it. I want evt_dt on x-axis and stacked graph with Y,N, and missing values percentage distribution filled with different colour. Could anyone identify the problem? Following is the code:
proc sgplot data=t2 cycleattrs ;
band x=evt_dt upper= mode_rate lower=0 / group=char_var name="vars" fill ;
yaxis min=0 label="CUM DIST PCT" grid;
xaxis label="evt_dt" Type=Discrete FitPolicy=RotateThin;
series x=evt_dt y=pct_row / lineattrs=(pattern=solid thickness=1.5px) markerattrs=(symbol=circlefilled)
markers group=char_var name="vars";
keylegend "vars" / location=outside position = right VALUEATTRS=(SIZE=10);
data looks like following:
i have referred following sample but couldn't generate the plot:
Thanks and appreciate in advance