09-18-2013 05:02 PM
From my searches seems the answer is NO but wanted to confirm...can I write the following on one line?
IF field1='testing' THEN
09-19-2013 07:34 AM
EG actually submits the code to SAS, so any rules that apply to SAS also apply to EG.
However, EG does have a nice code formatting utility...I find it great when I've hacked out some code, and can pretty it up before posting (I don't know if Display Manager has the same; I'm far from expert with it.)
Therefore, no problem submitting anything as one line...just don't make me maintain it!!
09-19-2013 09:36 AM
It is important to point out that Macros actually have a distinct line length that cannot be passed.
For example, if you wrapped your code into a macro and then put it all on one line (and it was a long code) it would actually fail because sas wouldstop compiling it after the Xth position (It depends on versions I believe).
So yeah, don't put your entire code on one line if you are wrapping it in a macro.
Source of Knowledge: I made this mistake once before.
09-18-2013 05:40 PM
Since SAS uses the semicolon as a statment ender it doesn't really care too much.An entire program could be on one line with only the white space between variables and functions to allow proper parsing by the complier.
However since people will be involved with maintaing the code it is a good idea to adopt some set of practices that use readibility as a criterion.
For example compare quick understanding of the code
if i = var1 then do; var1=3; m= catx(' ', var2,var3, v10); end; else do; var1=var3; end;
if i = var1 then
m= catx(' ', var2,var3, v10);
And the complier wouldn't care if you had:
if i =
then do; var1=3; m=
catx(' ', var2,var3, v10); end;
09-18-2013 06:02 PM
i think your code will do nothing except creating 3 variable field1, field2 and field3...if you simply want to create 3 field with same value,
Need further help from the community? Please ask a new question.