This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /*This program checks if the ODS GRAPHICS option is enabled | |
| Originally from: | |
| https://communities.sas.com/t5/ODS-and-Base-Reporting/Can-you-query-if-ODS-GRAPHICS-is-on-or-off/m-p/494271 | |
| */ | |
| *check current status; | |
| %put NOTE:- Current Status = &sysodsgraphics; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| %macro data2datastep(dsn=,lib=,outlib=,file=,obs=,fmt=,lbl=); | |
| %local varlist fmtlist inputlist msgtype ; | |
| %if %superq(obs)= %then %let obs=MAX; | |
| /*added by FKhurshed to set linesize to max. | |
| This allows the macro to output the datalines correctly to the | |
| log and not run over lines. Current value is stored here to reset | |
| at the end*/ | |
| %let LS= %sysfunc(getoption(LS)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /*--------------------------------------------------------------------------------*/ | |
| /* Author: F. Khurshed */ | |
| /* Date: June 17, 2011 */ | |
| /* Purpose: This macro creates a set of chisquare tables appended together. */ | |
| /* It includes the chisquare value. */ | |
| /* Modified by: F. Khurshed */ | |
| /* Date: January 17, 2012 */ | |
| /* Purpose: Adding in the ability for the macro to add the total column. */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| *sample data sets for demonstration; | |
| data price_20080131; | |
| set sashelp.class; | |
| test=1; | |
| run; | |
| data price_20080229; | |
| set sashelp.class; | |
| test=2; | |
| run; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| *create example data; | |
| data class; | |
| set sashelp.class; | |
| run; | |
| data class2; | |
| set sashelp.class; | |
| drop age sex; | |
| run; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /*This program calculates binomial percentages and confidence limits. | |
| Howver, this has no correction methodology so the lower bound can go below 0. | |
| In this case a different method is needed*/ | |
| *set table name to summarize; | |
| %let dsin=sashelp.class; | |
| *set variable name to get percentages; | |
| %let var = sex; | |
| *set name of output data set; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /*this creates a list of combinations, designed for numeric variables*/ | |
| %let n=5; /* total number of items */ | |
| %let k=2; /* number of items per row */ | |
| /* generate combinations of n items taken k at a time */ | |
| data Comb(keep=c1-c&k); | |
| array c[&k] (&k.*0); /* initialize array to 0 */ | |
| array list[&n] _temporary_ (1, 2, 3, 4, 5); | |
| ncomb = comb(&n, &k); /* number of combinations */ | |
| do j = 1 to ncomb; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /*This program checks if two variables exist in a data step and then does conditional logic | |
| if the variables are present | |
| This is also an example of CALL VNEXT()*/ | |
| /*Generate sample data*/ | |
| *both variables exist; | |
| data class1; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /*This program shows how an multilabel format works and that the summary statistics can be done at a unique level but also aggregated at a higher level included in the data.*/ | |
| /*sample data*/ | |
| data have; | |
| input Year Area $ Profit; | |
| cards; | |
| 2001 A 1 | |
| 2002 A 2 | |
| 2001 B 1 | |
| 2001 C 3 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /*This is an example of how to create multiple macro variables in | |
| one SQL step.*/ | |
| *note that you do not need to specify the number of items; | |
| *SAS will do that portion for you; | |
| proc sql noprint; | |
| select name into :name1- from sashelp.class; | |
| quit; | |
| %put &name1; |