when to release the record in the input buffer with the @ in sas? -


the following simple sas program:

data mydata;   group = 'placebo', 'active';      subj = 1 5;         input score @;         output;      end;   end;  datalines; 250 222 230 210 199 166 183 123 129 234 ; 

i learning sas myself. thinking make sure happens here. understanding, first line of 5 entries belongs group placebo , second line belongs group active. @ first, input buffer contains first line of 5 numbers, , subj=1 5 prints them out 1 one, until end of current data step iteration. then, data step continues second iteration. understanding correct? many time , attention.

ps. want make sure when release current input buffer. after checking online, found purpose of @ following:

holds input record execution of next input statement within same iteration of data step. line-hold specifier called trailing @.

so, means input buffer released if 1 of following 2 conditions met:

(1): new input statement met without @ or @@. (2): end of current data step iteration.

any comments appreciated.

your code should work fine, should see note sas went new line in log.

when group='placebo' inner loop (do subj ...) read 5 numbers , leave pointer @ end of first line. outer loop execute again group='active'. when tries read score subj=1 there nothing left on first line. sas skip next line , read first score there. other 4 values read line.

finally @ end of data step "release" line pointer @ beginning of line 3 (if there line three).

then whole data step loop 1 more time , set group='placebo' , subj=1, when tries read score reads past end of file , stops data step.

note program work fine long have 10 values spaced on many lines want.


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -