Advertisement
Guest User

Untitled

a guest
Sep 24th, 2019
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SAS 0.94 KB | None | 0 0
  1. data loopex4;
  2. seed=11023;
  3. do stickprov=1 to 1000;
  4.     do obs=1 to 80;
  5.     x=100*ranuni(seed);
  6.     output;
  7.     end;
  8. end;
  9. drop obs;
  10. drop seed;
  11. run;
  12.  
  13. proc summary data=loopex4;
  14.     by stickprov;
  15.     id x;
  16.     output out=WTPmax (drop= _TYPE_ _FREQ_ ) max(x)=;
  17. run;
  18.  
  19. data WTPmax;
  20. set WTPmax;
  21.     e=(80/((80+1))*100);
  22.     std=SQRT((80*(100*100))/(((80+1)*(80+1))*(80+2)));
  23.     xstd=(x-e)/std;
  24. run;
  25.  
  26. data WTPmax;
  27. set WTPmax;
  28.     if xstd < -2.5 then xgroup=1;
  29.     if xstd < -1.25 & xstd > -2.5 then xgroup=2;
  30.     if xstd < -0.5 & xstd > -1.25 then xgroup=3;
  31.     if xstd < 0 & xstd > -0.5 then xgroup=4;
  32.     if xstd < 0.5 & xstd > 0 then xgroup=5;
  33.     if xstd > 0.5 then xgroup=6;
  34. run;
  35.  
  36. proc print data=WTPmax;
  37. run;
  38.  
  39. proc format;
  40. value groupformat
  41.     1 = '<-2.5'
  42.     2 = '-2.5 - -1.25'
  43.     3 = '-1.25 - -0.5'
  44.     4 = '-0.5 - 0'
  45.     5 = '0 - 0.5'
  46.     6 = '>0.5'
  47.     ;
  48. run;
  49.  
  50. proc sgplot data=WTPmax;
  51. vbar xgroup / stat=percent barwidth=1 limits=both;
  52. format xgroup groupformat.;
  53. run;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement