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 example demonstrates the ODSTitle feature that allows you to | |
customize a title for an ODS Graphic, SAS 9.3+*/ | |
data Trans; | |
input Thick @@; | |
label Thick = 'Plating Thickness (mils)'; | |
datalines; | |
3.468 3.428 3.509 3.516 3.461 3.492 3.478 3.556 3.482 3.512 | |
3.490 3.467 3.498 3.519 3.504 3.469 3.497 3.495 3.518 3.523 | |
3.458 3.478 3.443 3.500 3.449 3.525 3.461 3.489 3.514 3.470 |
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
options noxwait noxsync; | |
data _null_; | |
*Path to winzip program; | |
zipexe='"C:\Program Files\7-Zip\7z.exe" a -tzip'; | |
*Zip file name; | |
zipfile="C:\My Documents\Sample.zip"; | |
*File to be zipped; | |
file="C:\Temp\Sample.txt"; | |
*Full cmd line to be passed to command line. It embeds the quotes for paths with spaces; |
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 code will print all the variables into the output window, | |
space delimited, replace the data= with the dataset of interest.*/ | |
proc contents data=sashelp.class short; | |
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
/*How to calculate the fiscal year start and end from a date value*/ | |
%let date="01Sep2013"d; | |
data _null_ ; | |
fstart=intnx('year.4',&date,0,'b') ; | |
fend=intnx('year.4',&date,1,'b')-1; |
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 a template for a tight table style for Word Documents, | |
RTF. | |
Originally written by Ryan Woods, BC Cancer Agency*/ | |
proc template; | |
define style styles.newrtf; | |
parent=styles.rtf; | |
style header / background = white font=(Times, 11pt, Bold); | |
replace fonts / | |
'TitleFont2' = ("Times",12pt,Bold Italic) |
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 Loops thoough a set of variables where the variables | |
are separated by "|". Any other delimiter can be used | |
and specified in the scan function as well*/ | |
%macro loop(varlist); | |
%let i=1; | |
%do %while (%scan(&varlist, &i, |) ^=%str()); | |
%let var=%scan(&varlist, &i, |); | |
%put &var; |
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 date dimension table that can be used for | |
looking up dates. This is less relevant as SAS has allowed | |
for custom intervals, but a quick solution often.*/ | |
%MACRO DATE_DIMENSION(startdate=, enddate=, outfil=); | |
data &outfil; | |
retain number_workdays; | |
do _n_ = &startdate to &enddate; |
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 illustrates how to age standardize rates using the age data for Canada 1991*/ | |
*Source Data:http://www.apheo.ca/resources/indicators/Standardization%20report_NamBains_FINALMarch16.pdf | |
*Source Code:http://support.sas.com/documentation/cdl/en/statug/65328/HTML/default/viewer.htm#statug_stdrate_syntax01.htm | |
; | |
*Create dataset with Canada Standard Rates for 1991; | |
data CanadaSTDRATE; | |
format AgeGroup 2. AgeGroupDesc $5. Canada1991 comma12.; | |
informat Canada1991 comma12.; |
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 code will create a libname reference to an Excel file and list all Sheets in the results window; | |
libname sample pcfiles path='C:\Temp\Sample_v2.xlsx'; *your statement will depend on your OS/Excel version; | |
proc contents data=sample._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
rsubmit wait=no macvar=check_test; | |
proc freq data=table.large_table; | |
table variable_levels/out=check; | |
run; | |
endrsubmit; |
OlderNewer