Last active
July 2, 2019 15:59
-
-
Save statgeek/3ba681b2fab3fb826ece2bfef14daf56 to your computer and use it in GitHub Desktop.
SAS - Example of how a format works
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 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; | |
data class; | |
set sashelp.class; | |
*create a variable identical to age, but formatted; | |
age_numeric_format = age; | |
format age_numeric_format words.; | |
*Recode variable into character rather than use a format; | |
age_character = put(age, words.); | |
run; | |
title 'Demo of Formats'; | |
proc print data=class; | |
run; | |
title 'Check formats and type for AGE variables'; | |
proc contents data=class;run; | |
title; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment