- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Posted 01-21-2010 09:41 AM
(3134 views)
How could you generate test data with no input data?
please explain it.
please explain it.
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Your SAS application (and its particular input requirements) must determine how you decide on "test data". For basic testing, the use of DATALINES; or for some CARDS; works to exercise code-path logic. For other, more comprehensive testing, you may need to acquire sample data streams from your input data-source owner(s), catalog these resources (possibly even down to some "versioning" level), and then create your test-scenarios based on these sources.
Of course, with SAS, you have the sample files in the SASHELP data library to reference, for some types of testing. And there are "public" data-source references you can find through Internet searches, while using good keywords and key-phrases.
Scott Barry
SBBWorks, Inc.
Of course, with SAS, you have the sample files in the SASHELP data library to reference, for some types of testing. And there are "public" data-source references you can find through Internet searches, while using good keywords and key-phrases.
Scott Barry
SBBWorks, Inc.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I like to start with PROC PLAN. You can easily generate a data set that can looks demography from a clinical trial. If you need to simulate more sophisticated variables like height and weight and have them seem reasonable requires some knowledge of the variable but it can be done with the aid of SAS random number functions.
[pre]
proc plan seed=152169984;
factors
usubjid = 100 ordered
trt=1 of 2;
treatments sex=1 of 2 race=1 of 4 age=1 of 50;
output out=testdata
usubjid nvals=(2001010001 to 2001010050 2001020051 to 2001020100)
trt cvals=('Placebo' 'Active')
sex cvals=('F' 'M')
race cvals=('White' 'Black' 'Asian' 'Other')
age nvals=(18 to 67 by 1)
;
run;
quit;
proc print;
run;
[/pre]
[pre]
proc plan seed=152169984;
factors
usubjid = 100 ordered
trt=1 of 2;
treatments sex=1 of 2 race=1 of 4 age=1 of 50;
output out=testdata
usubjid nvals=(2001010001 to 2001010050 2001020051 to 2001020100)
trt cvals=('Placebo' 'Active')
sex cvals=('F' 'M')
race cvals=('White' 'Black' 'Asian' 'Other')
age nvals=(18 to 67 by 1)
;
run;
quit;
proc print;
run;
[/pre]
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
imagine you have 4 columns c1-c4 for which you want test data with value in this list
c1 zxcv, f567, h789, n098
c2 12.34, 1234, 987, 1000000
c3 "Leena sasuser", "Peter C", "another"
c4 wq, er, ty
This is syntax that uses these [pre]data test_data1 ;
do c1= 'zxcv', 'f567', 'h789', 'n098' ;
do c2= 12.34, 1234, 987, 1000000 ;
do c3= "Leena sasuser", "Peter C", "another" ;
do c4= "wq", "er", "ty";
output ;
end ; end ; end ; end ;
run ; [/pre]It generates 4x4x4x3 rows of test data, every combination of those values.
Is that the model solution you want?
PeterC
c1 zxcv, f567, h789, n098
c2 12.34, 1234, 987, 1000000
c3 "Leena sasuser", "Peter C", "another"
c4 wq, er, ty
This is syntax that uses these [pre]data test_data1 ;
do c1= 'zxcv', 'f567', 'h789', 'n098' ;
do c2= 12.34, 1234, 987, 1000000 ;
do c3= "Leena sasuser", "Peter C", "another" ;
do c4= "wq", "er", "ty";
output ;
end ; end ; end ; end ;
run ; [/pre]It generates 4x4x4x3 rows of test data, every combination of those values.
Is that the model solution you want?
PeterC