Reputation: 49
So, I just buy introduction book for sas. But it only contain tons of examples with little/no explanation. I tried to find some tutorial online, but I can't find the explanation for this formatting. I just wonder what's the different between these two:
INPUT Name $16. Age 3. +1 height 5.1
I wonder, what does "." mean. What the different between:
INPUT Name $16
and
INPUT Name $ 1-16
what is the symbol "+1" mean?
what does "5.1" mean? how's that different from "5."? thx
Upvotes: 0
Views: 274
Reputation: 63424
Formats always contain periods; the period can serve to separate width from decimal, ie 5.1 is 5 total width, 1 decimal - so xxx.d
(actually, -xx.d
, but it will also display xxx.d
correctly). For character values and other values that cannot have decimal portions, there is never a number after the period, but it is still present; so DATE9.
is a DATE formatted variable (specifically, looks like "19JAN2013") and is 9 characters long (as opposed to DATE7.
, or 19JAN13).
In general, SAS has many different input options. Find a better book, or read the online documentation (http://support.sas.com/documentation/92/index.html or similar for your version of SAS). input Name $16.
inputs name as a 16 digit character variable. You have a lot of variants of input options, so look at the documentation to find out more.
+1 specifically tells SAS to move the pointer forward one - so instead of 16 characters of Name, then 3 digits of Age, then 5 digits of Height, it skips a space between Age and Height; so NAMENAMENAMENAMEage heigh
not NAMENAMENAMENAMEageheigh
.
Upvotes: 1