BookmarkSubscribeRSS Feed
laurenekerr
Calcite | Level 5

Why are my numeric values disappearing for the final table? - and why is (%) not calculating. 

 

/* Step 7: Add the p-value to the transposed table */
data FinalTable3;
merge TransposedTable_freq pvalue;
retain Asthma_Status State_8 State_54 p_value; /* Ensure proper column order */
label State_8 = "Colorado (N (%))"
State_54 = "West Virginia (N (%))"
Asthma_Status = "Current Asthma Status"
p_value = "P-Value";
run;

/* Step 8: Print the final table with p-value */
proc print data=FinalTable3; title "Final Table with P-value"; run;

/* Step 9: Make the table presentable using PROC REPORT */
proc report data=FinalTable3 nowd headline headskip split='/';
column Asthma_Status ('State' State_8 State_54) p_value;
define Asthma_Status / display "Asthma Status";
define State_8 / "Colorado (N (%))";
define State_54 / "West Virginia (N (%))";
define p_value / "P-Value";
run;


Screenshot 2024-12-06 at 11.05.11 AM.png 

2 REPLIES 2
ballardw
Super User

Any question about "why" should include the LOG from when you run the code. Many issues may generate a note or warning.

 

Likely examples of the INPUT data sets may be required to complete such a diagnosis. Data should be presented as working data step code that is posted into a text box opened on the forum with the </> icon above the message windows.

 

I don't see anything in the posted code that looks like it would attempt to calculate any percentage. Which would lead me to believe that problem lies earlier in your process. The output you show that looks like (.%) indicates that your process has converted two numeric variables to a single character and that the variable(s) used to create the percentage failed at that step or earlier.

Tom
Super User Tom
Super User

I don't think you ran those last two steps against the same dataset.

Let's make an example dataset.

data FinalTable3;
  input Asthma_Status $ State_8 $ State_54 $ p_value ;
  label State_8 = "Colorado (N (%))"
        State_54 = "West Virginia (N (%))"
        Asthma_Status = "Current Asthma Status"
        p_value = "P-Value";
cards;
Current 992(.%) 637(.%) 0.008
Former 424(.%) 203(.%) .
;

And try running those steps:

/* Step 8: Print the final table with p-value */
proc print data=FinalTable3; title "Final Table with P-value"; run;

/* Step 9: Make the table presentable using PROC REPORT */
proc report data=FinalTable3 nowd headline headskip split='/';
  column Asthma_Status ('State' State_8 State_54) p_value;
  define Asthma_Status / display "Asthma Status";
  define State_8 / "Colorado (N (%))";
  define State_54 / "West Virginia (N (%))";
  define p_value / "P-Value";
run;

Results:

Tom_0-1733509940569.png

 

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 2 replies
  • 544 views
  • 1 like
  • 3 in conversation