View sas_proportion_confidence_intervals.sas
/*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;
View sas_unique_combinations.sas
/*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;
View sas_var_exist.sas
/*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;
View sas_mlf_format
/*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
View sas_create_macro_variables_SQL.sas
/*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;
View sas_macro_variables_calculations.sas
/*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.;
View sas_correlation_heat_map.sas
/*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
*/
ods output PearsonCorr=Corr_P;
View sas_macro_convert_xlsx_csv.sas
/*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
View SAS_demo_format
/*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;
View SAS_freq_crosstab_table.sas
/*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;