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 doing calculations with a macro variable. | |
| In this case, all integers allow us to use %EVAL(). Otherwise you | |
| would need to use %SYSEVALF()*/ | |
| %let HYR = 2018; | |
| %Let Yr2 = %eval(&HYr. - 1); | |
| %Let Yr5 = %eval(&HYr. - 4); | |
| %put HYR: &hyr; | |
| %put YR2: &yr2.; |
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 is based on the question here: | |
| https://communities.sas.com/t5/SAS-GRAPH-and-ODS-Graphics/Removing-one-of-the-legends-from-a-heatmap/m-p/456131 | |
| The purpose is to create a correlation heatmap from a correlation matrix. | |
| Author: F. Khurshed | |
| Date: 2018-04-20 | |
| */ | |
| *calculate correlation matrix for the data; | |
| ods output PearsonCorr=Corr_P; |
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 will take a folder path (default) and look for files | |
| that are specifically with the specified extension (ext) and convert | |
| the files to CSV. It uses XCMD so you need to have that option enabled. | |
| The original script is from here: | |
| http://support.sas.com/kb/43/496.html | |
| Modified to convert XLSX to CSV. | |
| Author:F. Khurshed | |
| Date: 2018-03-23 |
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 demonstrates how a built in SAS format works. | |
| It uses the WORDS format to display the age as thirteen rather than 13. | |
| It also creates two additional variables, one is numeric and formatted, | |
| the second is a character variable with the same value | |
| Author: F.Khurshed | |
| Date: 2018-03-23 | |
| */ | |
| *Create a sample 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 program is used when you want multiple m*n tables and you want it summarized. In this case the one variable, SEX is in the | |
| KEEP statement, this will change depending on the variables in the code*/ | |
| ods output crosstabfreqs=summary; | |
| proc freq data=sashelp.class; | |
| table sex*(_all_); | |
| 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
| %macro ProvideSurvivalMacros; | |
| %global atriskopts bandopts censored censorstr classopts | |
| graphopts groups insetopts legendopts ntitles stepopts tiplabel | |
| tips titletext0 titletext1 titletext2 xoptions yoptions; | |
| %let TitleText0 = METHOD " Survival Estimate"; | |
| %let TitleText1 = &titletext0 " for " STRATUMID; | |
| %let TitleText2 = &titletext0 "s"; /* plural: Survival Estimates */ | |
| %let nTitles = 2; |
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 sample data; | |
| data random_sentences; | |
| infile cards truncover; | |
| informat sentence $256.; | |
| input sentence $256.; | |
| cards; | |
| This is a random sentence | |
| This is another random sentence | |
| Happy Birthday | |
| My job sucks. |
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
| /*Sourced from here: | |
| http://support.sas.com/kb/43/496.html | |
| */ | |
| options noxwait noxsync; | |
| %macro convert_files(default=,ext=); | |
| data _null_; | |
| file "'&default\temp.vbs'"; |
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 sample data for demonstration; | |
| data have; | |
| infile cards dlm='09'x; | |
| input OrgID Product $ States $; | |
| cards; | |
| 1 football DC | |
| 1 football VA | |
| 1 football MD | |
| 2 football CA | |
| 3 football NV |
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 demonstrates how to create a basic anonymized | |
| key for a unique identifier. Ensure you set the value in CALL | |
| STREAMINIT()/RANDOM_SEED macro variable to ensure you can | |
| replicate the keys if needed*/ | |
| %let random_seed = 30; | |
| *list of unique values; | |
| proc sql; | |
| create table unique_list as |