DATA Step, Macro, Functions and more

Question on referring to variables

Accepted Solution Solved
Reply
New Contributor
Posts: 2
Accepted Solution

Question on referring to variables

I am a fairly new user to SAS and have discovered some issues I can't get my head around.  I am working with a huge transactional data set.

I first created a data set that included a hashed customer identifier along with a new purchase column that was sorted in descending order.  I became curious with the observation that came to the top of this list.  So, I was interested in revealing the rest of the variables from the original data set that went along with this top customer's purchases (SKUs, date/time of purchase, etc).

Here's an example of what I entered (I'm just looking for the first entry for now since this is a huge data set and takes a long time to run.)

proc sql inobs=1;

select *

from ben.<datasetname>

where <identifier> like "3B342DC8";

run;

The result every time is not an error code but a blank results page.

The hashed customer identifier is of type hexadecimal and I'm wondering if that's what's causing my problems.  I have also tried the contains statement as well as % and _ to solve this issue and find out if there are any wild cards that I can't see.  No luck.

Any ideas?

Thank You!

Ben


Accepted Solutions
Solution
‎06-29-2011 06:33 PM
Respected Advisor
Posts: 3,777

Re: Question on referring to variables

Not sure I understand completely, but character hex constants are specified in SAS as "quoted hex string" followed by X.

"3B342DC8"x

View solution in original post


All Replies
Super User
Posts: 17,960

Question on referring to variables

Have you tried = and check the length of the character variable in your customer identifier and actual table.  Your actual variable in the dataset could have trailing spaces perhaps?

Could you explain how you created your hash identifier as well and how it maps to the old dataset?

Solution
‎06-29-2011 06:33 PM
Respected Advisor
Posts: 3,777

Re: Question on referring to variables

Not sure I understand completely, but character hex constants are specified in SAS as "quoted hex string" followed by X.

"3B342DC8"x

New Contributor
Posts: 2

Question on referring to variables

Thank you Reeza and data_null_:! 

Reeza - I forgot to mention that I had tried = first and checked the length of the customer identifier in the actual table, and concluded there were no trailing spaces in my first post.  I also wouldn't have been able to explain how the identifier was hashed because someone else had done it before me and sent it to me that way.

Data_null_: - I knew I was missing something small and somewhat obvious but I could not find the answer to why this was happening anywhere, and it was the x following the quoted string. 

Thanks again to you both for quick replies to my vague post.

Ben

🔒 This topic is solved and locked.

Need further help from the community? Please ask a new question.

Discussion stats
  • 3 replies
  • 146 views
  • 4 likes
  • 3 in conversation