Recent Activity
I am learning Macros and trying to create a Macro named %Macro REGION_SUMMARY using the table sashelp.cars, the macro executes proc means step for each region, I have stored the region names and count in macros REGION_LIST and REGION_COUNT. While I was trying to run the code when the REGION_LIST was separated by ' ' (space), there were no errors, but when I separated REGION_LIST by ' , ' then it's throwing an error "Macro function %SCAN has too many arguments." Also, the issue was resolved when I used the following code: %let REG=%sysfunc(strip(%sysfunc(scan(%bquote(®ION_LIST),&i,',')))); PROC SQL;
SELECT DISTINCT ORIGIN, COUNT(DISTINCT(ORIGIN)) INTO : REGION_LIST SEPARATED BY ',',
: REGION_COUNT
FROM SASHELP.CARS;
QUIT;
%PUT ®ION_LIST ®ION_COUNT;
%MACRO REGION_SUMMARY;
%DO i=1 %TO ®ION_COUNT;
%let REG=%sysfunc(strip(%sysfunc(scan(%bquote(®ION_LIST),&i,',')))); ;
title "Summary for ®";
proc means data= sashelp.cars ;
where ORIGIN="®";
by ORIGIN;
run;
%END;
%MEND;
%REGION_SUMMARY; how does the above code work? and why does the Below code doesn't work. PROC SQL;
SELECT DISTINCT ORIGIN, COUNT(DISTINCT(ORIGIN)) INTO : REGION_LIST SEPARATED BY ',',
: REGION_COUNT
FROM SASHELP.CARS;
QUIT;
%PUT ®ION_LIST ®ION_COUNT;
%MACRO REGION_SUMMARY;
%DO i=1 %TO ®ION_COUNT;
%LET REG=%scan(®ION_LIST,&i,%str(,));
title "Summary for ®";
proc means data= work.cars ;
where ORIGIN="®";
by ORIGIN;
run;
%END;
%MEND;
%REGION_SUMMARY; ERROR:
... View more

0
0
Hello
I want to color cells in specific column based on values in other column.
I have tried this code but in output result i dont see colors
data LONG1;
Input WD EXPD RCVD RCVD_ALL _NEWC_ $;
cards;
-1 49 49 56 Y
01 26 26 77 Y
02 77 45 0 N
03 71 0 0 N
04 44 0 0 N
;
RUN;
proc report data=LONG1 missing nowd;
column (WD, ( EXPD RCVD RCVD_ALL));
define WD / 'Working Day' across /*NOZERO*/ ORDER=DATA;
define EXPD / analysis 'Expd' missing;
define RCVD / analysis 'Rcvd' missing;
define RCVD_ALL / analysis 'Rcvd all' missing;
compute RCVD;
if _NEWC_ = "Y" then
do;
call define (_col_,"style", "style={background=green}");
end;
else if _NEWC_ = "N" then
do;
call define (_col_,"style", "style={background=red}");
end;
endcomp;
run;
quit;
... View more

0
1
Hey, folks- I'm trying to build a simple pipeline for ensembling logistic regression using the SAS Viya Studio's "Build Model" feature and I get these errors: "This project could not be initialized" and "The data advisor failed to run on the selected data source." Here's a sample of the log file: NOTE: Added action set 'cardinality'.
ERROR: Could not load the format YESNO_ALT of the variable ewe.
ERROR: Generic error.
ERROR: Action summarize failed.
ERROR: The action stopped due to errors.
NOTE: PROCEDURE CARDINALITY used (Total process time):
real time 0.17 seconds
cpu time 0.01 seconds
NOTE: The table DMDSLIB.STATISTICS does not exist in Cloud Analytic Services.
ERROR: File DMDSLIB.STATISTICS.DATA does not exist.
NOTE: The SAS System stopped processing this step because of errors.
NOTE: Due to ERROR(s) above, SAS set option OBS=0, enabling syntax check mode.
This prevents execution of subsequent data modification statements.
WARNING: The data set WORK.STATISTICS may be incomplete. When this step was stopped there were 0 observations and 0 variables.
NOTE: DATA statement used (Total process time):
real time 0.02 seconds
cpu time 0.01 seconds
ERROR: Variable _VARNAME_ not found.
NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE SORT used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds
ERROR: Variable _VARNAME_ is not on file WORK.STATISTICS.
ERROR: Variable _ORDER_ is not on file WORK.STATISTICS.
ERROR: Variable _CARDINALITY_ is not on file WORK.STATISTICS.
ERROR: Variable _SUMFREQS_ is not on file WORK.STATISTICS.
ERROR: Variable _NMISS_ is not on file WORK.STATISTICS.
ERROR: Variable _MIN_ is not on file WORK.STATISTICS.
ERROR: Variable _MAX_ is not on file WORK.STATISTICS.
ERROR: Variable _STDDEV_ is not on file WORK.STATISTICS.
ERROR: Variable _MEAN_ is not on file WORK.STATISTICS.
ERROR: Variable _NOBS_ is not on file WORK.STATISTICS.
ERROR: Variable _SKEWNESS_ is not on file WORK.STATISTICS.
ERROR: Variable _KURTOSIS_ is not on file WORK.STATISTICS. I'm attaching the full log file. My computer is a PC, 64-bit, running Windows Enterprise 10 and SAS Viya is "Data Explorer" release 2.5, SAS Viya release V.03.05. How can I get the SAS Viya to initialize the project? I'm at my wit's end with SAS Viya. It looks like a really powerful tool for ML, but I've found that even basic things like reading in data are hard to figure out and time-consuming. Thanks, David
... View more

0
0
I am working in SAS LSAF (Life Science Analytics Forum) environment. I found &sysinfo after proc compare did not work since its value is always 0. I tried this simple example:
data a;
a=1;
run;
data b;
a=2;
run;
proc compare base=a comp=b;
run;
%put &sysinfo;
Can you help?
... View more

0
0
Hello!
I am looking for help on a SAS program I have where I run multiple Proc Tabulate analysis for select counties via a macro. I would like to have all proc tabulate outputs for each county in an individual tab named as the county name. Currently it outputs to one tab and it is a lot of data to scroll through all the counties together. Sample data attached.
options orientation=portrait missing=0; ods listing close; ods html path="&path" file="&file";
%macro desc(location);
/*YTD TOTALS - COUNTY REPORTS*/
title1 "Cases of Disease in &location County, Year Total";
proc tabulate data=work.disease2 format=5.;
where DiagAddress_County = "&location";
format sex $sex. evyear evyear. age agegrp. ;
class evyear age sex / missing preloadfmt;
tables evyear=' '*age=' ' all*evyear=' ',sex=' ' all/printmiss box='Age' rts=25;
keylabel n=' ' all='Total';
run;
proc tabulate data=work.disease2 format=5.;
where DiagAddress_County = "&location";
format sex $sex. evyear evyear. race2 $race. ;
class evyear race2 sex / missing preloadfmt;
tables evyear=' '*race2=' ' all*evyear=' ',sex=' ' all/printmiss box='Race' rts=25;
keylabel n=' ' all='Total';
run;
proc tabulate data=work.disease2 format=5.;
where DiagAddress_County = "&location";
format sex $sex. evyear evyear. ethnicity2 $ethnic.;
class evyear ethnicity2 sex / missing preloadfmt;
tables evyear=' '*ethnicity2=' ' all*evyear=' ',sex=' ' all/printmiss box='Ethnicity' rts=25;
keylabel n=' ' all='Total';
run;
proc tabulate data=work.disease2 format=5.;
where DiagAddress_County = "&location";
format sex $sex. evyear evyear. FacilityType $prvtype.;
class evyear sex / missing preloadfmt;
class FacilityType / order=formatted missing preloadfmt;
tables evyear=' '*FacilityType=' ' all*evyear=' ',sex=' ' all/printmiss box='FacilityType' rts=25;
keylabel n=' ' all='Total';
run;
%mend; %desc(CountyA); %desc(CountyG); %desc(CountyZ);
... View more

0
3
Unanswered topics
These topics from the past 30 days have no replies. Can you help?
Subject | Likes | Author | Latest Post |
---|---|---|---|
0 | |||
0 | |||
0 | |||
0 | |||
0 | |||
0 | |||
0 | |||
2 | |||
1 | |||
0 |