It is a good question. I use a DDL then modify a little bit the code to make sure that SAS EG will understand it. Then, I execute that code in order to obtain an empty data set with all the variables name and variable length as well. Some variable are characters, others are numeric. I could have as many as 500 variables. Some are characters variables, some are numeric. I don't want call the variable by name. So I though that using array could be a good solution to fill up the dataset with generated data. The tests I have done up to now involve the use of array to declare variable such as var1-var500 and length to specify the length by statement length $50 $40 ... and so on. It works very fine. I was able to generate synthetic data. But now, my challenge is to used a template (empty data set) and I though with the help of array to generate synthetic data but it does seem to work. Here's the code I have tested. it works if I have at least one observation, but with no observation (the stop statement is added), it does not work. Is there a way to overcome this difficulty. Data test; set sashelp.class (obs=1); array nums(*) _numeric_; array chrs(*) _character_; call symputx('nb1',dim(nums),'G'); call symputx('nb2',dim(chrs),'G'); /* stop; */ run; %put &nb1; %put &nb2; Data test2; set test; array nums(*) _numeric_; array chrs(*) _character_; Do k=1 to 100; do i=1 to &nb1; nums{i}=5+i; end; do j=1 to &nb2; chrs{j}=cat('test',j); end; output; end; run;
... View more