## Programming the statistical procedures from SAS

N/A
Posts: 0

I run following code:
input ID \$ 1-4 Name \$ 6-19 Sex \$ 21 Age 23-24
Date 26-27 Height 29-30 Weight 32-34
ActLevel \$ 36-39 Fee 41-46;
format fee 6.2;
run;

I guess 'ID \$1-4',it will produce a parameter,its width is 4,but I don't understand 'Sex \$21' width is 1,why? And 'Weight 32-34' width is 8,why?

input ID \$ 1-4 Name \$ 6-19 Sex \$ 21 Age 23-24
Date 26-27 Height 29-30 Weight 32-34
ActLevel \$ 36-39 Fee 41-46;

Where is 5,20,22,25,28,31,35,40? Why omit them?
Posts: 2,116

## Re: Question about \$ sign

Suggest you check out the chapter on reading raw data in the SAS/Base Concepts manual:

http://support.sas.com/documentation/cdl/en/lrcon/61722/HTML/default/a001112330.htm

The answers to most of your questions are there. The others can be found by reading about the INPUT statement in the SAS Language Reference Dictionary..

Doc Muhlbaier
Posts: 3,805

## Re: Question about \$ sign

> I run following code:
> input ID \$ 1-4 Name \$ 6-19 Sex \$ 21 Age 23-24
> Date 26-27 Height 29-30 Weight 32-34
> ActLevel \$ 36-39 Fee 41-46;
> format fee 6.2;
> run;
>
> I guess 'ID \$1-4',it will produce a parameter,its
> width is 4,but I don't understand 'Sex \$21' width is
> 1,why? And 'Weight 32-34' width is 8,why?
>

these are column number ranges and in SAS without other statements to define the variable attributes the column numbers serve that purpose.
\$1-4 character length 4
\$21 same as \$21-21 character length 1
32-34 NO \$ sign numeric. All numerics default to lenght 8.

>
> Where is 5,20,22,25,28,31,35,40? Why omit them?

Those columns are skipped. No mistery.