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

I read variable=contain(1)......

IS it posibble to write theassignement above?

1 ACCEPTED SOLUTION

Accepted Solutions
Astounding
PROC Star

If you read this as part of a SAS program, it means a DATA step contains an array named CONTAIN.  That statement would assign (as the value of VARIABLE) the first element in the array.

View solution in original post

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

Hi,

 

Could you be a little bit more verbose in the description of the problem, perhaps posting example test data (form of a datastep) and what the output should look like.  I am going to guess that 1 is a character, and you want to search in a string of characters to see if that character exists and if so assign a boolean response to variable 1 being found, 0 not being found:

data have;
input a $;
b=ifn(findc(a,"1") > 0,1,0);
datalines;
045674
341232
run;
Astounding
PROC Star

If you read this as part of a SAS program, it means a DATA step contains an array named CONTAIN.  That statement would assign (as the value of VARIABLE) the first element in the array.

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
  • 1152 views
  • 0 likes
  • 3 in conversation