Hello All, I need help debugging and understanding errors in my code. What I want is a permanent dataset named Data.ChiSqResults that looks like this: Test DF Value P-Value Chi-Square 2 1.71 0.43 What I start with: See picture ~"Statistics for Table of Death BY State" But I run my code I get two warnings and an empty dataset. For some Reason, my Ods Output isn't saving to my Work Library and I don't know why. I tried changing locations to the folder Library.Heartattack but that didn't work either. I tried closing my SAS and that didn't help either. I was able to get ODS OUTPUT to work one time but I don't know how I did that and it seemed like a goof as it didn't rerun. But even when it did run, I got an empty table (See last picture) as it didn't seem to recognize my IF statement. In addition, I also recieved the sporadic warning: "WARNING: Duplicate data set name on ODS OUTPUT statement. Entry will be ignored." and I don't know what triggers it. TODO: Isolate the "Chi-Square" Observation in a new Permanent Dataset (HIGHEST PRIORITY) Round the Value and Probability to 2 decimal places without trailing zeroes. CODE * Step 2: Perform a Chi-Square Test and Save the Results *; RUN; ODS TRACE ON; PROC FREQ DATA = heartattack.ANALYSIS2; TABLES Death * STATE /CHISQ NOROW NOPERCENT; RUN; ODS TRACE OFF; ODS OUTPUT CROSSTABFREQS = WORK.STATES CHISQ = WORK.CHISQRESULTS; /* ODS OUTPUT CROSSTABFREQS = Heartattack.CROSSTABFREQS */ /* CHISQ = heartattack.CHISQ; */ DATA WORK.CHISQRESULTS; SET Heartattack.CHISQRESULTS; KEEP STATISTIC DF VALUE PROB; LABEL PROB = "P-VALUE"; IF STATISITIC = "Chi-Square"; VALUE = ROUND(VALUE, 0.01); PROB = ROUND(PROB, 0.01); RUN; PROC PRINT DATA = Heartattack.CHISQRESULTS NOOBS; RUN; LOG 1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK; NOTE: ODS statements in the SAS Studio environment may disable some output features. 73 74 ODS TRACE ON; 75 PROC FREQ DATA = Heartattack.HYPANALYSIS2; 76 TABLES HYPRELDEATHIND * STATECD /CHISQ NOROW NOPERCENT; 77 RUN; Output Added: ------------- Name: CrossTabFreqs Label: Cross-Tabular Freq Table Template: Base.Freq.CrossTabFreqs Path: Freq.Table1.CrossTabFreqs ------------- Output Added: ------------- Name: ChiSq Label: Chi-Square Tests Template: Base.Freq.ChiSq Path: Freq.Table1.ChiSq ------------- NOTE: There were 573 observations read from the data set heartattack.HYPANALYSIS2. NOTE: PROCEDURE FREQ used (Total process time): real time 0.89 seconds cpu time 0.67 seconds 78 ODS TRACE OFF; 79 80 ODS OUTPUT CROSSTABFREQS = WORK.STATEPERCENTS 81 CHISQ = WORK.CHISQRESULTS; 82 83 /* ODS OUTPUT CROSSTABFREQS = HYPRSLT.CROSSTABFREQS */ 84 /* CHISQ = Heartattack.CHISQ; */ 85 86 DATA WORK.CHISQRESULTS; 87 SET Heartattack.CHISQRESULTS; 88 KEEP STATISTIC DF VALUE PROB; 89 LABEL PROB = "P-VALUE"; 90 IF STATISITIC = "Chi-Square"; 91 VALUE = ROUND(VALUE, 0.01); 92 PROB = ROUND(PROB, 0.01); 93 RUN; NOTE: Variable STATISITIC is uninitialized. NOTE: There were 6 observations read from the data set Heartattack.CHISQRESULTS. NOTE: The data set WORK.CHISQRESULTS has 0 observations and 4 variables. NOTE: DATA statement used (Total process time): real time 0.19 seconds cpu time 0.17 seconds 94 95 PROC PRINT DATA = Heartattack.CHISQRESULTS NOOBS; 96 RUN; WARNING: Output 'CHISQ' was not created. Make sure that the output object name, label, or path is spelled correctly. Also, verify that the appropriate procedure options are used to produce the requested output object. For example, verify that the NOPRINT option is not used. WARNING: Output 'CROSSTABFREQS' was not created. Make sure that the output object name, label, or path is spelled correctly. Also, verify that the appropriate procedure options are used to produce the requested output object. For example, verify that the NOPRINT option is not used. NOTE: There were 6 observations read from the data set Heartattack.CHISQRESULTS. NOTE: PROCEDURE PRINT used (Total process time): real time 0.40 seconds cpu time 0.34 seconds 97 98 99 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK; 111 SCREENSHOTS
... View more