BookmarkSubscribeRSS Feed
Pyrite | Level 9



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.




Thanks in advance!



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;

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. 

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!

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.



Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

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.

Get the $99 certification deal.jpg



Back in the Classroom!

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

View all other training opportunities.

Discussion stats
  • 3 replies
  • 1 like
  • 2 in conversation