From: Ya Wei on
proc sql;
create table new_file as
select code, A , B1, B2
from myfile;

quit;run;

I have the following dataset and need to create a report with a
percentage to be calculated in. For some reason, the calcualted field
new_field all showed up as missing value, can someone tell me what may
cause this? Thanks.

proc report data=new_file;
columns code A B1 B2 new_field;

define code / group;
define A / display;
define B1/ noprint;
define B2 / noprint;
define new_field/ format=&percent;
compute new_field ;
new_field=B1 / B2;
endcomp;
run;
From: Ya on
On May 19, 7:37 am, Ya Wei <pearsonmel...(a)gmail.com> wrote:
> proc sql;
>     create table new_file as
>         select code, A , B1, B2
>         from myfile;
>
> quit;run;
>
> I have the following dataset and need to create a report with a
> percentage to be calculated in. For some reason, the calcualted field
> new_field all showed up as missing value, can someone tell me what may
> cause this? Thanks.
>
> proc report data=new_file;
>         columns code A B1 B2 new_field;
>
>         define code / group;
>         define A / display;
>         define B1/ noprint;
>         define B2 / noprint;
>     define new_field/ format=&percent;
>         compute new_field ;
>                 new_field=B1 / B2;
>         endcomp;
> run;

I think you need the 'computed' keyword :

define new_field/ format=&percent. computed;

Ya