This file contains 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 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 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 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 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; |
This file contains 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
data ordinal_format; | |
length label $8.; | |
do number=1 to 300; | |
numstring = put(number, 16. -l); | |
if prxmatch('/(?<!1)1\s*$/',numstring) then ending='st'; | |
else if prxmatch('/(?<!1)2\s*$/',numstring) then ending='nd'; | |
else if prxmatch('/(?<!1)3\s*$/',numstring) then ending='rd'; | |
else ending = 'th'; | |
ordstring =catt(numstring, ending); |
This file contains 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
*valid in SAS 9.3+, using the dynamic variable _byval_ that is automatically created by SAS; | |
proc template; | |
define statgraph scatter; | |
dynamic _x _y _byval_; | |
begingraph; | |
entrytitle "Scatter Plot of " _x " by " _y " for Sex = " _byval_; | |
layout overlay; | |
scatterplot x=_x y=_y; |
This file contains 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
<?php | |
$conn = new COM("ADODB.Connection"); | |
$conn->Open('Provider=sas.IOMProvider.9.3;User ID=user;Password=pass;Data Source="";SAS Machine DNS Name=my.server.com;SAS Port=8591;SAS Protocol=2'); | |
$cmd = new COM("ADODB.Command"); | |
$cmd->ActiveConnection = $conn; | |
$cmd->CommandType = 1; | |
$cmd->CommandText = 'libname foo "/my/path"'; | |
$cmd->Execute(); |
This file contains 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
PROC MAPIMPORT OUT=Polygon DATAFILE="Boundaries.shp"; | |
run; | |
data Polygon; | |
set Polygon; | |
by feature_name notsorted; | |
if first.feature_name then order=0; | |
else order+1; | |
run; |
This file contains 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
proc sort data=sashelp.class out=class; | |
by age; | |
run; | |
data _null_; | |
set class; | |
by age; | |
retain count; | |
if first.age then do; |
OlderNewer