data perm.people;
infile census;
retain Address;
data perm.people;
infile census;
retain Address;
input type $1. @;
H
,
use an INPUT statement to read the values for Address. However, if
Type is P
, then use an INPUT statement
to read the values for Name, Age, and Gender.
data perm.people; infile census; retain Address; input type $1. @; if type='H' then input @3 address $15.;
H
,
the INPUT statement reads the values for Address. However, when the
value of type is not H
, the expression
is evaluated as false, and the INPUT statement is not executed. Notice
that the value is enclosed in quotation marks because it is a character
value.
if type='h' then ... ;
P
,
Name, Age, and Gender are read, and an observation is written to the
data set. Remember that you want to create an observation for detail
records only.
data perm.people; infile census; retain Address; input type $1. @; if type='H' then input @3 address $15.; if type='P'; input @3 Name $10. @13 Age 3. @16 Gender $1.; run;
data perm.people (drop=type);
infile census;
retain Address;
input type $1. @;
if type='H' then input @3 address $15.;
if type='P';
input @3 Name $10. @13 Age 3. @16 Gender $1.;
run;
data perm.people (drop=type); infile census; retain Address; input type $1. @; if type='H' then input @3 address $15.; if type='P'; input @3 Name $10. @13 Age 3. @16 Gender $1.; run;
18.225.235.144