Data visualization with SAS programming

developing graph

Reply
Contributor
Posts: 22

developing graph

Can someone Help me in developing such graph?

Financing patterns for firms with built investment differentiated by size (at). The figure shows the median financing proportions in the event year (t=0) for small, medium, and large firms defined according to total assets (at) of the firms at the end of each fiscal year. Built1 have value either missing or 1. I need to consider only value=1

data work.new;
  infile datalines dsd truncover;
  input FYEAR:BEST12. CUSIP:$10. DEBT:BEST12. EQUITY:BEST12. CASHFLOW:BEST12. OTHER:BEST12. BUILT1:BEST12.;
datalines;
1989,000361,7.698,0,28.44,-17.723,
1990,000361,-22.256,-2.326,21.348,12.118,
1991,000361,6.873,0,13.32,-11.975,
1992,000361,-1.005,-1.164,3.547,5.947,
1993,000361,24.974,-0.066,-4.042,-14.882,
1994,000361,5.101,-0.177,8.728,-4.579,
1995,000361,-1.632,-1.552,7.332,3.399,
1996,000361,-1.474,-8.08,9.237,30.609,1
1997,000361,49.177,1.642,75.305,-80.481,1
1998,000361,2.053,-7.558,58.331,-1.52,1
1999,000361,25.401,-10.53,51.327,-43.854,
2000,000361,-26.364,-0.211,15.383,27.526,
2001,000361,50.093,34.129,-61.586,2.727,
2002,000361,-32.643,0,19.333,23.24,
2003,000361,-4.914,0,18.328,-3.128,
2004,000361,-24.005,0,37.194,-0.156,
2005,000361,140.624,0,-7.015,-117.313,1
1989,000781,8.331,0,2.291,-0.506,1
1990,000781,4.208,0,2.612,-1.327,
1991,000781,0.201,0,2.37,0.155,
1992,000781,0.423,0,4.249,0.348,
1993,000781,16.199,0,4.647,-2.124,1
1994,000781,21.157,0,6.914,-5.987,1
1989,00099V,-37.088,0,-151.117,-324.79,
1990,00099V,-57.638,0,359.763,226.468,
1991,00099V,15.556,0,71.947,-121.261,
1992,00099V,-116.575,0,109.166,95.715,
1993,00099V,-286.093,0,252.856,-329.048,
1994,00099V,63.7,0,40.4,-38.6,
1995,00099V,205.6,0,155.7,-252,1
1996,00099V,57.8,0,184.2,-124.8,
1997,00099V,582.2,15,-125.6,-373.8,
1998,00099V,-6.5,0,431.8,-323.6,
1999,00099V,172.4,0,99.6,-74.6,1
2000,00099V,84.4,0,190.2,-76.2,
2001,00099V,-118.9,45,14.1,208.6,
2002,00099V,81.8,15,273,-258.8,
2003,00099V,-143.6,0,42.4,326.4,1
1989,000872,2.711,0.001,-0.404,-0.148,
1990,000872,1.995,0.006,-1.005,0.277,
;;;;

figure 2.jpg
Trusted Advisor
Posts: 1,137

Re: developing graph

This is an untested code but you could try 

 


proc transpose data=new out=want;
where built1=1;
by group;
var DEBT EQUITY CASHFLOW OTHER;
run;

proc sgplot data=want /*sganno=anno pad=(bottom=5%)*/;
   vbar group / response=col1 group=_name_ groupdisplay=cluster;
   xaxis display=(nolabel novalues noticks);
   keylegend / location=inside position=topleft across=1;
run;
Thanks,
Jag
Contributor
Posts: 22

Re: developing graph

 

When I use these codes

proc transpose data=sas out=want;
where built=1;
by group;
var DEBT EQUITY CASHFLOW OTHER;
run;

It turns out with following error. What coult be the possible reason for this all the variable debt, equity, cashflow and other are present in the data file.

66   proc transpose data=sas out=want;
67   where built=1;
68   by group;
ERROR: Variable GROUP not found.
69   var DEBT EQUITY CASHFLOW OTHER;
70   run;

NOTE: The SAS System stopped processing this step because of errors.
WARNING: The data set WORK.WANT may be incomplete.  When this step was stopped there were 0
         observations and 0 variables.
WARNING: Data set WORK.WANT was not replaced because this step was stopped.
NOTE: PROCEDURE TRANSPOSE used (Total process time):
      real time           0.01 seconds
      cpu time            0.01 seconds

 

Trusted Advisor
Posts: 1,137

Re: developing graph

[ Edited ]

 

If you try the below code you should get the output as displayed. However the issue over here is when we tranpose we get multiple columns for results liek col1 col2 and so on.

 

So you need to be sure what type of data you want in the graph. But for the moment you could try the sgplot as i mentioned.

 

proc sort data=new;
by cusip;
run;

proc transpose data=new out=want;
where built1=1;
by CUSIP;
var DEBT EQUITY CASHFLOW OTHER;
run;

 

 

image.png

Thanks,
Jag
Contributor
Posts: 22

Re: developing graph

how to plot the graph according to three sizes(small, medium, large) on the basis of total assets(at). As defined in the attached picture?


graph.jpg
SAS Super FREQ
Posts: 925

Re: developing graph

To get a graph of that form, you will need to use PROC SGPANEL. Run thsi following code to see an example.:

 

proc sgpanel data=sashelp.prdsale;
panelby year / layout=columnlattice colheaderpos=bottom noborder onepanel novarname;
colaxis display=(nolabel);
vbar region / response=actual group=product groupdisplay=cluster;
run;
Ask a Question
Discussion stats
  • 5 replies
  • 374 views
  • 0 likes
  • 3 in conversation