Re: How to search list of particular text values into free text
On Mon, 18 Jun 2007 12:02:45 -0400, SUBSCRIBE SAS-Nim Pat
>Please if anyone has idea about how to search particular list of text
>values from one small table to free text variable in large dataset and
>when finds the value, update the large dataset.
>I have small lookup table (around 120 records) for example:
>Now I need to search each particular text values (variable-Types) from the
>above small table into my large dataset which has free text variable
>Order_details: The last order was for the Mangos on Nov 11 2006.
>I’m using following code but it’s not efficient:
>Create table new_Main_Table AS
>when Order_details contains (‘Mangos’) then “Type_1”
>when Order_details contains (‘Pineapples’) then “Type_1”
>when Order_details contains (‘Onions’) then “Type_2”
>when Order_details contains (‘Tomatoes’) then “Type_2”
>when Order_details contains (‘typeN’) then “Type_n”
>Else “ “
>End As order_Types
>From Main_table ;
>Thanks for your time and help,
>I really appreciate your effort,
Guys Sorry for the Inconveniencies. I'm attaching sample table.
my Small lookup table:
Data SmallTAble ;
Le...Re: How to search list of particular text values into free text #2
Sorry, there was a minor error, b.types should be b.category:
create table xx as
select distinct a.srno,a.order_details,
max(case when a.order_details contains trim(b.types) then b.category
else '' end) as btype
from large_table a, smalltable b
group by a.srno
order by a.srno
Srno Order_details btype
1 The order of Mangos .. Type_1
10 Retured all Potatoes.. Type_2
2 The returned order .. Type_1
3 Order for the Oranges .. Type_1
4 new container for the Onions .. Type_2
5 Boxes of Grapes received .. Type_1
6 Almonds boxes received .. Type_3
7 Dry fruits received on .. Type_4
8 Spinach were tossed out .. Type_2
9 Begs of Potatoes .. Type_2
On Tue, 19 Jun 2007 00:27:45 -0400, Ya Huang <ya.huang@AMYLIN.COM> wrote:
>This one may not be efficient when look up table are big,
>but at least it saves your typing:
>create table xx as
>select distinct a.srno,a.order_details,
>max(case when a.order_details contains trim(b.types) then b.types else ''
>end) as btype
>from large_table a, smalltable b
>group by a.srno
>order by a.srno
>Srno Order_details btype
> 1 The order of Mangos .. Mangos
> 10 Retured all Potatoes .. Potatoes
> 2 The returned o...How to search list of particular text values into free text
Please if anyone has idea about how to search particular list of text
values from one small table to free text variable in large dataset and
when finds the value, update the large dataset.
I have small lookup table (around 120 records) for example:
Now I need to search each particular text values (variable-Types) from the
above small table into my large dataset which has free text variable
Order_details: The last order was for the Mangos on Nov 11...Re: Searching for partial text in character variables in SAS #3
hi ... in addition to Nat's suggestion, you could also look at the FIND function
(it may be more intuitive to FIND a string rather INDEX a string, but that's just me!)
as Nat mentioned, if you are concerned whether case would cause you to miss a match,
the FIND functions allows you to ignore case by specifying another argument ('i' for ignore case)
input string $50.;
i = index(string,'insur');
* ignore case when searching;
f = find(string,'insur','i');
i am insured
I AM NOT INSURED
sure, I'm Insured
i'm sure of that
Obs string i f
1 i am insured 6 6
2 I AM NOT INSURED 0 10
3 sure, I'm Insured 0 11
4 i'm sure of that 0 0
U@Albany School of Public Health
One University Place
Rensselaer, New York 12144-3456
> The INDEX function should work for you:
> INDEX (src,str) first position of string str located in string src
> In your case a statement such as
> If INDEX( notes , 'INSUR' ) then ...
> where notes is the name of the variable and INSUR is the string that you
> are seeking. I left blank the outcome of the statement but most likely
> would want to select only these records so you would write
> If INDEX( notes , 'INSUR' );
> You don't really care what the position of...Re: Exporting a SAS data set to Text file on SAS unix #3
hi ... actually, what I posted earlier was too much code (sorry)
this is enough (a bit more succinct)
* variable names into a macro variable (tab separated);
proc sql noprint;
select name into :vars separated by '09'x
where libname eq 'SASHELP' and memname eq 'CLASS'
file 'z:\class.txt' dsd dlm='09'x ;
if _n_ eq 1 then put "&vars";
put (_all_) (:);
U@Albany School of Public Health
One University Place
Rensselaer, New York 12144-3456
Wondering how what I input to my UTF-8 terminal gets passed along
through my patched  trn ...
А Б В Г Д Е Ж З И Й К Л М Н О П
а б в г д е ж з и й к л м н о п
ᴀ ᴁ ᴂ ᴃ ᴄ ᴅ ᴆ ᴇ ᴈ ᴉ ᴊ ᴋ ᴌ ᴍ ᴎ ᴏ
ɀ Ɂ ɂ Ƀ Ʉ Ʌ Ɇ ɇ Ɉ ɉ Ɋ ɋ Ɍ ɍ Ɏ ɏ
...Re: SAS Text Editor #3
I got the add ons from the text pad website. Thanks anyway. If there is any other better free editor, please let me know.
cherish k <firstname.lastname@example.org> wrote: Hi Dan,
Thanks for the reply. I too use Textpad but I don't know how to how to set it up so that it can highlight for the SAS syntax. How to configure it for the SAS extension syntax.
"Nordlund, Dan (DSHS/RDA)" <NordlDJ@dshs.wa.gov> wrote: > -----Original Message-----
> From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On
> Behalf Of cherish k
> Sent: Monday, April 28, 2008 10:43 PM
> To: SAS-L@LISTSERV.UGA.EDU
> Subject: SAS Text Editor
> Can somebody direct me to a good SAS text editor for Windows.
> Basically I need for just syntax highlighting (I don't need
> an editor with prompts etc).
If all you need is syntax highliting, I would recommend Textpad (what I use on a regular basis) or UltraEdit (an excellent editor). I am sure others will soon list their favorites.
Hope this is helpful,
Daniel J. Nordlund
Research and Data Analysis
Washington State Department of Social and Health Services
Olympia, WA 98504-5204
Save all your chat conversations. Find them online.
Get the freedom to save as many mails as you wish. Click here to know how.
Wrapping works if you have the justification set to left and do not display
the horizontal scroll bar.
From: RH Savanur [mailto:r_savanur@YAHOO.COM]
Sent: Friday, September 17, 2004 9:08 AM
Subject: SAS/AF - How to enable text wrapping in Text pad..?
Is there any facility for automatic text wrapping for "TEXTPAD" component..?
Thanks in advance.
This message contains confidential information intended only
fo...text + text
What is "text + text" supposed to do right now? It doesn't seem very
useful to me. What about making "text + text" as an equivalent for "text
|| text"? Most strongly-typed programming languages do this. And MS SQL
Server too, I think (CMIIW).
---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to email@example.com
Am Freitag, 8. Oktober 2004 12:57 schrieb David Garamond:
> What is "text + text" supposed to do right now?
> What about making "text + text" as an equivalent for "text
> || text"? Most strongly-typed programming languages do this. And MS SQL
> Server too, I think (CMIIW).
What would this gain except for bloat? It's not like SQL is utterly
compatible with any programming language; users will still have to learn all
the operators anyway.
---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match
Peter Eisentraut wrote:
>>What is "text + text" supposed to do right now?
Then are these bugs? (7.4.5 and 8.0.0beta1 give same results). Frankly,
the current behaviour is quite strange to me.
=...Re: Text Date To SAS Date? #3
On Wed, 31 Oct 2007 13:24:27 -0500, data _null_, <datanull@GMAIL.COM> wrote:
>The YMDdttm informat may be what you want.
It appears that the minimum width for this format is 13 (because it really
expects to see the time subfield), so there are situations where it will not
be able read just a date value.
Here is an alternative:
y = 'yyyy-mm-dd';
y = '2007-10-31';
dt = dhms(input(y,yymmdd10.),0,0,0);
format dt datetime20.;
>1328 data _null_;
>1329 y = 'yyyy-mm-dd';
>1330 y = '2007-10-31';
>1331 dt = input(y,ymddttm.);
>1332 format dt datetime20.;
>1333 put (_all_)(=);
>Notice the TIME part is 0 which may or may not be useful for you.
>On 10/31/07, Jonathan Wolgamuth <firstname.lastname@example.org> wrote:
>> I've looked around quite a bit and am finding that this question comes up
>> quite a bit, however, I'm flummoxed on how to get it to work on a field I'm
>> working with.
>> Basically, the field (eff_dt) is a 10 character text field in this format.
>> I need to convert this field to a DATETIME20. field so I can compare it to
>> another field that is already set to that format.
>> Should I parse out t...Re: Indenting text in SAS editor? #3
Mark the text,
press the tab indent putton
Mark the text
Press the Shift TAb to decrease teh indent level
Works for me
---- David Wright <David_wright@SPRA.COM> wrote:
> email@example.com (RolandRB) wrote in
> >David Wright wrote:
> >> Is there a quick way to indent a range of text in the (enhanced) SAS
> >> editor?
> >> How about submitting text?
> >> -Using SAS 9.1 for windows xp2
> >Isn't it done by...Re: reading text field into sas #3
From SAS 8.x character variables may be maximally 32k bytes long, I think either 32767 or 32768 characters.
Regards - Jim.
.. . . . . . . . . . . . . . . .
Jim Groeneveld, MSc.
6825 MJ Arnhem
Tel: +31/0 26 376 7365
Fax: +31/0 26 376 7305
Showing statistically significant differences between football teams,
generally all sporters, requires larger samples than usually applied.
From: Jamil Ibrahim [mailto:jibrahim@i...RE: [SPAM] - Re: [SPAM] - Re: Serialize wxList - Found word(s) list error in the Text body
your approach is modelled along the MFC serialization idea, the approach =
I mentioned is based on the XTI metadata provided for an object. So the =
streaming itself is not coded anymore, but the metadata for a new class =
The streaming process now iterates over the attributes, processes =
callbacks that avoid streaming out undesired attributes (eg x and y in a =
sizer dialog), suppresses default values etc. This also means that the =
streaming in survives missing attributes, as long as they are either not =
mandatory params for ::Create or have a default value.
B...Can I use SAS to search and replace a piece of text in, say, 1000 text files?
How can I use SAS to search and replace a piece of text in, say, 1000 text
files? Thanks for letting me know.
...Re: How to handle very large text strings in SAS ?? #3
On Fri, 11 Nov 2005 14:16:37 -0800, David L Cassell <davidlcassell@MSN.COM>
>If you are trying to do genetic anlayses, or soemthing which can be treated
>it were anlaysis of DNA strings, then you might want to look into
Or, just load the txt file into a (*real*) editor and do repeated
search/find. A text file of 10 million characters are not even 10 mega byte
large. My emacs (even on windows) handles it very well and I used it to
verify my sas code posted... (now that sounds so wrong...) This is
definitely a Friday-only answer... :-)
Cheer...Re: Saving values in a format in text form #3
Look at the options CNTLOUT and CNTLIN on PROC FORMAT - they deal with how
you get the formats in a dataset and then back into the format catalog from
a dataset. That's probably the easiest way to deal with your root question.
On Tue, Feb 9, 2010 at 2:20 PM, White, Svend A. <SvendW@health.ok.gov>wrote:
> I need to tweak some formats that are currently in use and as part of
> the process am extracting all the existing formats and creating a new
> setup script (which hopefully won't get lost this time).
> Here's the process I'm using.
> 1. Execu...Re: Searching for partial text in character variables in SAS
The INDEX function should work for you:
INDEX (src,str) first position of string str located in string src
In your case a statement such as
If INDEX( notes , 'INSUR' ) then ...
where notes is the name of the variable and INSUR is the string that you
are seeking. I left blank the outcome of the statement but most likely
would want to select only these records so you would write
If INDEX( notes , 'INSUR' );
You don't really care what the position of the string is other than you
want a value other than zero which would mean that the string was not
found. You may want to convert the notes file to either upper or lower case
-- ie, notes = upcase(notes ); -- in order to simplify the search.
Environmental Specialist III
Dominion, Environmental Biology
4111 Castlewood Rd
Richmond, VA 23234
Phone:804-271-5313, Fax: 804-271-2977
Sent by: "SAS(r) SAS-L@LISTSERV.UGA.EDU
Searching for partial text in
character variables in SAS
Please respond ...Re: Changing from Text to Value for a bunch of variables #3
If you can clarify how this is going to be used, it will be helpful. If you
are going to simply display them as 1 and 0 in a report, you can do that
with a format. If you are going to use them for analysis, then you will have
to change the variable type from character to numeric. That too is possible,
but only at the expense of actually creating a new variable and renaming it
to the old variable. You already have an answer for the latter. If it the
proc format ;
value $yesno "YES" = "1"
"NO" = "0"
"Yes" = "1"
"No" = "0" ;
title "After Format" ;
proc print ;
format c1 - character - c4 $yesno. ;
This assumes that the variables of interest are the only character variables
that exist in the PDV between the two variables mentioned in the format
statement. Yes, numeric variable can exist in between without doing any
From: jsl [mailto:nospam@NOSPAM.COM]
Sent: Tuesday, September 02, 2003 8:50 AM
Subject: Changing from Text to Value for a bunch of variables
I have about 20-30 variables in a large dataset that take on the value "YES"
or "Yes" and "No" or "NO". I would like to very quickly and easily change
them all to numeric va...Re: Inputting Date/Time Values Stored As Text #3
I wonder why you didn't find is8601dt
On 5/11/07, Peter Crawford <firstname.lastname@example.org> wrote:
> On Fri, 11 May 2007 10:25:34 -0700, Scott Barry <sbarry@SBBWORKS.COM>
> >On May 11, 12:21 pm, "Deborah Testa" <dte...@sevenofninesystems.com>
> >> Hello,
> >> I am working with a data file that stored date/time values as text like
> >> this:
> >> 2005-08-01 17:52:33
> >> Is there a quick way to get this into a datetime variable without
> >> parsing the two pieces?
> >> Thanks,
> >> Deborah
> >In a DATA step, use the INPUT statement to read up the two fields
> >using the appropriate "date" and "time" INFORMAT, and then combine
> >them into a "datetime" variable using the DHMS function, substituting
> >the "time" variable as the Seconds argument of DHMS, and use "0" for
> >the Hour and Minute arguments.
> >Scott Barry
> >SBBWorks, Inc.
> Hi Scott
> I've been using the SAS9 sashelp.vformat resource to search for correct
> The code
> data test ;
> set sashelp.vformat ;
> where fmttype='I' ; *just informats;
> where also fmtname ne:'$' ; * and not character informats;
>...Re: SAS term: character string, text expression #3
Don't Lisp, Forth, and related programming languages allow all sorts of
liberties in definitions of functions and procedures? As I recall, a
Lisp EVAL() function attempts to execute any expression. As for the lack
of a distinction between variables and program, OOP deliberately blurs
that faint line. Perhaps SAS in this case, as with logical expressions,
blazed the trail into 4th generation programming languages.
I don't recall a specific point at which the SAS language evolved into a
compile-and-go language with step boundaries, or who led that effort. By
the time programmers began r...Re: Spit out formatted text of a specific value in dataset #3
Hmmm not needing anyother dat ais a but odd but okay:
Data Sample ;
Input Id Name $ ;
FileName Title '/export/home/dunnt/Test.HTML' ;
Data _Null_ ;
Set Sample ( Where = ( ID = 2 ) ) ;
File Title ;
Put '<H1>' Name '</H1>';
You could do this through pure macro code but that seems a but extreme
unless there is some other circumstances where it is needed.
Two wrongs are only the beginning.
Success always occurs in private and failure in full view.
Experience is something you don't get until just after you need it.
From: webonomic <webonomic@GMAIL.COM>
Reply-To: webonomic <webonomic@GMAIL.COM>
Subject: Re: Spit out formatted text of a specific value in dataset
Date: Thu, 23 Aug 2007 13:51:50 -0700
That #ByVal(n) is awesome. Found a great reference to it here (http://
Thanks for pointing it out. Some simple macro work will get me much
closer to what I am after.
Okay, so we have our basic version:
input Id Name;
ods html file = 'c:\_webout.html'; * Win ;
title 'This is my title' #ByVar(Id)
proc print d...Re: input or list question on reading in a text file? #3
Jerry L Diebal posted the following:
> I have a file that has data like what is in the cards datastep below:
> data test;
> input datastuff $ ;
> keep datastuff ;
> NAME OF CITY
> NAME OF CITY
> NAME OF CITY
> Each record consists of 9 lines like in the sample and each is
> separated by a blank line. The leading zeroes need to be retained on
> any variable starting with a zero. Can someone show me how to turn the
> above into a dataset? Thanks in advance.
Check out this TESTED program. It should get you pretty close to where
you need to go!
input #1 @7 mixedline $16.
#4 @7 nameofcity $12.
#7 @7 bigdate mmddyy10.
#9 @7 mixedline2 $3.
#10 blankline $ 1.
...Re: how to output number of missing values of a text variable on #3
One more think I do not know about SQL. There are so many.
On 10/22/08, Haris <Karovaldas@gmail.com> wrote:
> Good one, Data _Null_, NMISS function seems to work equally well for
> NUM and CHAR variables and eliminates the need for SUM! Runs faster
> proc sql;
> select catx(' ','nmiss(',name,') as', name)
> into :syntax separated by ", "
> from dictionary.columns
> where Libname = "WORK" AND MemName = "MISSING" ;
> %put NOTE: GENERATED SYNTAX: %bquote(&syntax);
> title 'Missing' ;
> select &Syntax
> from Missing;
> On Oct 21, 5:30 pm, iebup...@GMAIL.COM ("./ ADD NAME=Data _null_,")
> > Using the MISSING function this can be simplified somewhat.
> > proc sql;
> > select catx(' ','sum(missing(',name,')) as', name)
> > into :syntax separated by ", "
> > from dictionary.columns
> > where Libname = "WORK" AND MemName = "MISSING" ;
> > %put NOTE: GENERATED SYNTAX: %bquote(&syntax);
> > select &Syntax
> > from Missing;
> > quit;
> > On 10/21/08, Haris <Karoval...@gmail.com> wrote:
> > > How about something like this:
> > > data missing ;
> > > input a 1 b...Re: Searching for partial text in character variables in SAS #2
There are also the PERL regular expression functions. But you will
have to wait for the late sleeping "regEXperts" to wake up and load up