BookmarkSubscribeRSS Feed
michtka
Fluorite | Level 6


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

4 REPLIES 4
Reeza
Super User

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;

michtka
Fluorite | Level 6

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

michtka
Fluorite | Level 6

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

Reeza
Super User

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.

CFC_SAS_Communities_400x225.jpg

Call for content now open!

It's your turn to help shape SAS Innovate 2027. Share your expertise and inspire the SAS community.

Submit your proposal →

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 2690 views
  • 3 likes
  • 2 in conversation