View SAS_missing_report
*create sample data to work with;
data class;
set sashelp.class;
if age=14 then
call missing(height, weight, sex);
if name='Alfred' then
call missing(sex, age, height);
View SAS_missing_proc_stdize
*Create sample with missing data;
data missing;
set sashelp.class;
if mod(_n_, 2) eq 1 then
call missing(of _numeric_);
*Display for example purposes;
title 'Original data';
/*this is an example of time series data.
1. Create a time series data set with missing intervals (IBM)
2. Add back missing entries using PROC TIMESERIES (IBM_NO_MISSING)
3. Calculate moving average - 12 month average
data ibm;
set sashelp.stocks;
where stock='IBM';
View convert_doc2docx.vbs
bRecursive = False
sFolder = "C:\_localdata\temp\Test"
Set oFSO = CreateObject("Scripting.FileSystemObject")
Set oWord = CreateObject("Word.Application")
oWord.Visible = True
Set oFolder = oFSO.GetFolder(sFolder)
/*This code demonstrates how to keep only duplicate observations in a data set*/
%*Create sample data set;
data have;
informat name $80.;
input name $ found;
If_True 1
If_True_kary 1
If_True_kary 1
View sas_rank_prefix
%macro rank_prefix(data_in = , data_out= , varList= , prefix= , n_groups =);
%*Create rename list with prefix;
data _null_;
length new_v_list $100.;
string = "&varList";
n_words = countw(string);
do i=1 to n_words;
var = scan(string, i);
rankVar = catt("&prefix", var);
View sas_individual_words
data random_sentences;
infile cards truncover;
informat sentence $256.;
input sentence $256.;
This is a random #sentence
This is another #random sentence
Happy Birthday #test#together
My job#sucks.
This is a good idea, not.
View sas_dynamically_format_labels
data class;
set sashelp.class;
label name="NAme" sex="GEndeR" age="Age" height="HeiGht" weight="kilograms";
proc sql noprint;
select catx('=', name, quote(propcase(coalescec(trim(label), name))))
into :label_list separated by " " from sashelp.vcolumn where libname='WORK'
and upper(memname)='CLASS';
View sas_time_series_lag
%macro lag(vars, lags);
%let m = %sysfunc(countw(&vars));
%do i=1 %to &m;
%let var = %scan(&vars,&i);
%do j=1 %to &lags;
lag_&var.&j = lag&j(&var);
Here's a bit of a long way to generate the list of datasets with variables present. This program looks at ALL variables, to restrict it to a select list, see the line of code to be modified via the comments.
The method is similar but no macros.
/*Generate fake data to work with*/
data class1;
set sashelp.class;
drop age sex;
data class2;