BookmarkSubscribeRSS Feed
7 REPLIES 7
novinosrin
Tourmaline | Level 20

perhaps like this:

call missing(count);

do _n_=1 to dim(TwentyItems );

 if TwentyItems (_n_)='neutral' then count+1;

end;

 

 

or assign count=0 initial

 

count=0 ;

do _n_=1 to dim(TwentyItems );

 if TwentyItems (_n_)='neutral' then count+1;

end;

novinosrin
Tourmaline | Level 20

Are you sure, you are NOT dropping by accident at all?

 

CALL missing(KNeutral);

 

   IF TwentyItems {J} = 3 then KNeutral + 1;

 

The very moment the code complies, sas builds the descriptor portion of the dataset with all variables includingthe new assignment variable in the PDV(program data vector). There is not a chance this can be automatically dropped from your output. Please check thoroughly

Reeza
Super User

@FSHN wrote:

There variable is there, but I'm not getting my frequency tables to appear as I'd like. Thanks for help me get this far.


You haven't shown what you want or 'like', what you have or what your code is at this point so there's probably very little we can say regarding your problem at this point. 

 

A generic guess would be to transpose your data - don't bother trying to count it in a wide format - and then use PROC FREQ to summarize it.

 

ballardw
Super User

@FSHN wrote:

There variable is there, but I'm not getting my frequency tables to appear as I'd like. Thanks for help me get this far.


And what does " I'm not getting my frequency tables to appear as I'd like." actually mean in coding terms? Do you have the frequency value but not in table of the desired format? The frequencies are incorrect? Something else?

 

Show what the desired table should look like and best would be to provide some example data to build a table with.

 

Perhaps you want one of the other procedures that will report a count such as Proc Report or Tabulate.

 

 

Reeza
Super User

And this is the reason, everyone with less than 100 pts gets their questions quoted....keep at it.

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
  • 7 replies
  • 3408 views
  • 0 likes
  • 4 in conversation