BookmarkSubscribeRSS Feed
ebardaka5
Calcite | Level 5

Hello,

I am trying to use data from the Luxembourg Income Study online database. It is a database of household surveys from different countries. This database has a user interface through which I can analyze the data using SAS, but not directly access or see the data. I cannot create plots, and I cannot print the raw data. For example, the following frequency statement gets rejected because it is considered printing of raw data:

*** dhi = disposable household income, hpopwgt = inflated household weight ***;

PROC FREQ DATA=&it04h;

TABLES dhi;

WEIGHT hpopwgt;

RUN;

I need to create a histogram of the income distribution. I cannot use the histogram statement in proc univariate because plots are not allowed. I only need the table that gives the bin midpoint and the observed percent. I am looking for a different piece of code that would give me the same results that the code below gives (apart from the plot obviously):

DATA Italy04;

     SET &it04h;

     DO i=1 TO hpopwgt;

          OUTPUT;

     END;

RUN;

PROC UNIVARIATE DATA=Italy04;

    VAR dhi;

    HISTOGRAM dhi / MIDPERCENTS NMIDPOINTS=100;

RUN;

I am new to SAS and I very much appreciate your help Smiley Happy

2 REPLIES 2
Ksharp
Super User

How about using   proc rank  to group these raw data ,then  proc freq  get these group's freq ?

ebardaka5
Calcite | Level 5

Thank you for your reply Smiley Happy

I ended up using the following but I will check proc rank as well:

proc means data=&it04h mean min max;

var dhi;

output out=tmp min=mindhi max=maxdhi;

run;

data forbin;

set tmp;

bin=(maxdhi - mindhi)/100;

drop i;

retain fmtname 'bin' type 'n';

do i = 0 to 99;

  binstart = mindhi+(i*bin);

  binend = binstart + bin-0.01;

  label = cat(binstart,"  to  ", binend);

  output;

end;

run;

proc format cntlin=forbin (rename=(binstart=start binend=end)); run;

proc freq data=&it04h;

format dhi bin.;

table dhi ;

weight hpopwgt;

run;

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 1313 views
  • 0 likes
  • 2 in conversation