BookmarkSubscribeRSS Feed
chinna0369
Pyrite | Level 9

Hi,

 

I am creating a table, but there are no values for two trt groups. How can I add them?

Below is the example, c3 and c4 are missing.

 

anyalamadugu_0-1691423507823.png

 

Thanks in advance!

Adi

 

3 REPLIES 3
ballardw
Super User

"How" would typically involve a data step.

 

The picture you have implies there are no variables C3, C4 (and possibly C6, C7 and C8). If that is correct an there are no values in the data set and you want to add variables that have missing values it could be as  simple as:

data want;
   set have;
   C3=.;
   C4=.;
run;

But, since you show what I consider pretty poor data, as in two values in each of those variables one might ask exactly what properties you expect to see for the two added variables. While answering that I would suggest looking where this came from and perhaps there is something that needs to be addressed earlier as this looks like possibly the result of transposing or something else to an existing data. 

chinna0369
Pyrite | Level 9

Yes, I am transposing the results which are coming from proc means. I got it now, I have created dummy dataset with all possible trt groups and added before transposing the dataset. Now it looks good. Thanks!

ballardw
Super User

Depending on your data since you are using Proc means or summary you may want to look at the documentation of the COMPLETETYPES procedure option if you are using Class variables. That will create all the combinations for all the class variables so this may help prevent this in the future. May not. But if you are sub-setting data and transposing it may be helpful.

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 670 views
  • 1 like
  • 2 in conversation