BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
ROHINISDAS
Obsidian | Level 7

how can i find the credit card numbers which  range from A1-A100 for all the 3 types Gold, Platinum and Titanium, if there is any card holder with any other value, i need to create a dataset and excel file “Invalid_Cards”. Remove these invalid customers from the list of Individual cards list.

 

 

excel1.PNG

1 ACCEPTED SOLUTION

Accepted Solutions
Ksharp
Super User
Post your data as text NOT picture.

data have;
input id x $20.;
cards;
1 Gold
1 Platinum 
1 Titanium
2 Gold
2 Platinum 
2 Titanium
2 xxxx
;
run;
proc sql;
create table invalid as
select *
 from have
  group by id
   having sum(x not in ('Gold' 'Platinum' 'Titanium')) ne 0;
quit;

View solution in original post

2 REPLIES 2
RW9
Diamond | Level 26 RW9
Diamond | Level 26

Is this a SAS question or and Excel question? From what you have posted you haven't even imported the data into SAS.  If you need to do this in Excel, best place would be an Excel forum.  If you need to use SAS, then start by importing your data to three datasets, then apply your logic in a datastep (where 1 <= input(compress(customer,,"a),best.) <= 100, for instance).  Then you export the data again using proc export or ods tagsets or libname excel etc.

Ksharp
Super User
Post your data as text NOT picture.

data have;
input id x $20.;
cards;
1 Gold
1 Platinum 
1 Titanium
2 Gold
2 Platinum 
2 Titanium
2 xxxx
;
run;
proc sql;
create table invalid as
select *
 from have
  group by id
   having sum(x not in ('Gold' 'Platinum' 'Titanium')) ne 0;
quit;

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 2 replies
  • 1339 views
  • 1 like
  • 3 in conversation