I'm curious about how SAS handles informats and input statements with informats. What's the "order of operations" of these statements? I included an example snippet from a program that SAS EG Import Wizard generated.
Disclaimer: I rarely use EG Import Wizard, but my employer has asked that we use EG when possible, i.e. creating new programs, so I was curious how this functionality worked.
Data:TimeStamp
01/01/2019 12:00:00 AM
Example EG Generated Code:
data Input;
length TimeStamp 4;
format TimeStamp mmddyy10.;
informat TimeStamp mmddyy10.;
...some infile statement...
input TimeStamp : Best32;
TimeStamp = DatePart(TimeStamp);
run;
The above example is the code EG generated, but I'm curious as to why all these statements were generated. I'm also unsure of why SAS used the : Best32
informat with the input statement when my Import Wizard states DateTime18.
Historically, using BASE SAS, I've just used:
- Informat with an input statement
- An informat statement and then a following input statement. The input statement would then have only contained the variable name.
Example of #1:
Data Test;
...infile...;
input @1 TimeStamp DateTime18.;
...format...;
run;
Example of #2:
Data Test2;
...infile...;
informat TimeStamp DateTime18.;
input TimeStamp;
...format...;
run;
Is Example #1 just shorthand of Example #2? If so, why is EG generating the extra steps? In the EG Generated Code - how is the informat
statement not overriding the input
statements informat