Help using Base SAS procedures

creating classdata

Reply
Super Contributor
Posts: 301

creating classdata


Hi guys, there is any alternative way to create a classdata dataset,

not using cards, or datalines? Thanks in advance. V

I need to create a classdata dataset like this one:

dataset classdata:

1

2

3

Super User
Posts: 17,942

Re: creating classdata

You need to provide more information on what you're trying to do.

You can use a do loop and output statement but I have no idea if that's what you're looking for.

data want;

do i=1 to 3;

output;

end;

run;

Super Contributor
Posts: 301

Re: creating classdata

The idea is that, I got this dataset:

cat population       trt    count    

A population_d      1   1

A total                  3   1

B population_d      1    1

B total                  3   1

C population_d      1   1

C total                  3   1

In terms of show the report, populationx_p (trt=2), count=0 is not appear, and rather to put it manually  (hardcode), I want to introduce it using classdata:

classdata population

population_d 

population_p

total

classdata trteatment

1

2

3

to get the final dataset:

A population1_d   1   1

A population2_p   2   0

A total                 3   1

B population1_d   1    1

B population2_p   2    0

B total                 3    1

C population1_d    1   1

C population2_p     2   0

C total                   3   1

Super Contributor
Posts: 301

Re: creating classdata

sorry that one:

A population_d   1   1

A population_p   2   0

A total                 3   1

B population_d   1    1

B population_p   2    0

B total                 3    1

C population_d    1   1

C population_p     2   0

C total                   3   1

Super User
Posts: 17,942

Re: creating classdata

You posted a similar question a few days ago, regarding color and models.

The solution is similar, create an empty dataset and join via proc sql.

A better solution is to ensure the data is generated will all the values, using sparse option in proc freq or another option.

Ask a Question
Discussion stats
  • 4 replies
  • 160 views
  • 3 likes
  • 2 in conversation