BookmarkSubscribeRSS Feed
deleted_user
Not applicable
How could you generate test data with no input data?
please explain it.
3 REPLIES 3
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
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.
data_null__
Jade | Level 19
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]
Peter_C
Rhodochrosite | Level 12
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

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 2624 views
  • 0 likes
  • 4 in conversation