Make a variable based on a pattern for sas dataset -
i made dataset random numbers outcome , observation. want every other value 0 , other 1 i'm unsure how proceed. there way can tell sas either pattern or give evens value or something?
id outcome trt 1 1 0 2 1 1 3 0 0 4 1 1
etc. looked @ maybe using mod understand take values out of dataset not create information treatment.
mod function. functions have arguments, , return value. mod work you. n automatic variable counts how many times data step has iterated. try:
data want ; set have ; trt = mod(_n_,2) ; run ;
Comments
Post a Comment