BookmarkSubscribeRSS Feed
🔒 This topic is locked. We are no longer accepting replies to this topic. Need further help? Please sign in and ask a new question.
jason4sas
Obsidian | Level 7

I was computing a temp variable with proc imstat: 

 

crosstab re_subj*bigsmall/ tempnames=bigsmall tempexpress="if number='big' then bigsmall='bigger ';

else bigsmall='smaller';";

run;

 

The values for 'smaller' is 1-character shorter, i.e. 'smalle' instead.  Therefore, I assume it is a variable length problem, like in data step.  Is there any way to fix the issue in proc imstat.

 

Thanks

6 REPLIES 6
Cynthia_sas
SAS Super FREQ
Hi:
If you are using one of the classes in the SAS Academy for Data Science, can you explain what module you're in, what course and lesson you're working one and the demo or exercise where you encountered issues?

That will provide the Data Science instructors with the information they need.
Thanks, in advance,
Cynthia
jason4sas
Obsidian | Level 7

Sure.  Here is the info:

 

module:  Module 2: Big Data Programming and Loading

course:   Getting Started with SAS® In-Memory Statistics

lesson:   Chapter 3 Exercise 2-b

 

Thanks

Cynthia_sas
SAS Super FREQ
Thanks for the information, we can ask the instructors who teach the course what they recommend. Stay tuned!
Cynthia
Cynthia_sas
SAS Super FREQ

Hi:

  What the instructors said was that:

"There is no way to control the length of a temp variable in IMSTAT, that I know of. You have to use different logic to work your way into it. I would advise them to reverse the logic. The longer variable value is now assigned first and should fix the issue.

 

tempexpress="if number NE 'big' then bigsmall='smaller ';

else bigsmall='bigger';";

 

  By putting the larger value first, the length will be set based on the length of the first string in the assignment for the BIGSMALL variable."

 

  Hope this helps,

Cynthia

jason4sas
Obsidian | Level 7

Many thanks for the solution.  Alternatively, can blank spaces be used to pack it up like this?

 

tempexpress="if number NE 'big'

                                 then bigsmall='bigger  ';

                                 else bigsmall='smaller';";

 

There is an empty space after the text in 'bigger'.  it should also work, right?

 

Jason

Cynthia_sas
SAS Super FREQ
Hi, Jason:
I would guess it should work that way. However, I do not know whether IMSTAT trims trailing blanks. You'll just have to test it to see.
Cynthia

 

This is a knowledge-sharing community for learners in the Academy. Find answers to your questions or post here for a reply.
To ensure your success, use these getting-started resources:

Estimating Your Study Time
Reserving Software Lab Time
Most Commonly Asked Questions
Troubleshooting Your SAS-Hadoop Training Environment

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 6 replies
  • 1116 views
  • 0 likes
  • 2 in conversation