01-19-2023
sasmaverick
Obsidian | Level 7
Member since
09-11-2013
- 77 Posts
- 11 Likes Given
- 0 Solutions
- 1 Likes Received
-
Latest posts by sasmaverick
Subject Views Posted 1419 01-18-2023 08:56 PM 1548 01-17-2023 07:24 PM 1582 01-17-2023 06:59 PM 3351 06-16-2022 12:41 AM 3369 06-15-2022 11:50 PM 3377 06-15-2022 11:12 PM 994 06-15-2022 05:28 AM 3473 06-14-2022 10:52 PM 1504 01-04-2018 11:10 AM 1527 01-04-2018 10:25 AM -
Activity Feed for sasmaverick
- Posted Re: Select Subset of a Group and Return All Rows on SAS Programming. 01-18-2023 08:56 PM
- Liked Re: Select Subset of a Group and Return All Rows for Ksharp. 01-18-2023 08:54 PM
- Posted Re: Select Subset of a Group and Return All Rows on SAS Programming. 01-17-2023 07:24 PM
- Tagged Re: Select Subset of a Group and Return All Rows on SAS Programming. 01-17-2023 07:24 PM
- Posted Select Subset of a Group and Return All Rows on SAS Programming. 01-17-2023 06:59 PM
- Posted Re: Create Volatile Table in Teradata Using ODBC on SAS Programming. 06-16-2022 12:41 AM
- Posted Re: Create Volatile Table in Teradata Using ODBC on SAS Programming. 06-15-2022 11:50 PM
- Got a Like for Re: Create Volatile Table in Teradata Using ODBC. 06-15-2022 11:48 PM
- Posted Re: Create Volatile Table in Teradata Using ODBC on SAS Programming. 06-15-2022 11:12 PM
- Posted Unable to Transfer Large SAS Dataset to Teradata Using ODBC on SAS Programming. 06-15-2022 05:28 AM
- Tagged Create Volatile Table in Teradata Using ODBC on SAS Programming. 06-14-2022 10:53 PM
- Tagged Create Volatile Table in Teradata Using ODBC on SAS Programming. 06-14-2022 10:53 PM
- Tagged Create Volatile Table in Teradata Using ODBC on SAS Programming. 06-14-2022 10:53 PM
- Posted Create Volatile Table in Teradata Using ODBC on SAS Programming. 06-14-2022 10:52 PM
- Liked Re: Restructure Dataset for RW9. 01-04-2018 11:11 AM
- Posted Re: Restructure Dataset on SAS Programming. 01-04-2018 11:10 AM
- Posted Re: Restructure Dataset on SAS Programming. 01-04-2018 10:25 AM
- Posted Restructure Dataset on SAS Programming. 01-04-2018 09:57 AM
- Posted Re: Summarize by Multiple Variables in Data Step on SAS Programming. 12-29-2017 02:32 AM
- Liked Re: Summarize by Multiple Variables in Data Step for jklaverstijn. 12-29-2017 02:32 AM
-
Posts I Liked
Subject Likes Author Latest Post 3 1 1 1 1 -
My Liked Posts
Subject Likes Posted 1 06-15-2022 11:12 PM
03-18-2015
03:17 PM
I am trying to create multiple macro variables based on various conditions. Below is my code. I am not sure whether this is the most efficient way. *to get total number of obs and max value of count variable where count<5; proc sql noprint; select count(*),max(count) into : count1, count2 from dataset1 where count<5 ;quit; *to get total number of obs and max value of count variable where count>=5; proc sql noprint; select count(*),max(count) into : count1, count2 from dataset1 where count>=5 ;quit; *count of name where count>=5; proc sql; select count (distinct name) into:cnt from dataset1 where count>=5; quit; *count of name where count<5; proc sql; select count (distinct name) into:cnt from dataset1 where count<5; quit; *get names into macro where count<5; proc sql select distinct name into : name1-:name&sysmaxlong from dataset1 where count<5; quit; repeat the above step for count>=5 Is there a shorter/more concise way for the above. Will appreciate inputs on a more efficient approach. Thanks!
... View more
03-05-2015
06:24 AM
I have the below dataset: Name Jack Chirikjian Dean Rosenthal Dean Rosenthal Dean Rosenthal John Adams John Adams I need a code which will conditionally create text (tab delimited files), each containing the names. E.g: File1.txt Jack Chirikjian File2.txt Dean Rosenthal Dean Rosenthal Dean Rosenthal File3.txt John Adams John Adams Also, I need to email these files as attachments to their respective emails. Eg Jack will get an email with file1.txt, Dean will get with File2.txt and so on. (assume I have the emails addresses) Greatly appreciate the inputs.
... View more
02-08-2015
05:22 AM
I have a dataset below: Region ID Company Group Count East 12345 XYZ Customer 7 East 45678 ABC Customer 7 East 45677 IUTA Customer 7 East 23456 JHUY Provider 9 East 09876 IOPU Provider 9 West 89765 BNJK Customer 12 West 76545 OPOU Customer 12 West 32378 YUIO Supplier 10 West 35357 IOPI Provider 15 West 72348 RTYU Provider 15 I want the output in the following format using proc report. Region=East ID Company Group Count 12345 XYZ 45678 ABC 45677 IUTA -------------------------------------------------------------- CUSTOMER 7 -------------------------------------------------------------- 23456 JHUY 09876 IOPU ------------------------------------------------------------- PROVIDER 9 ------------------------------------------------------------- Region=West ID Company Group Count 89765 BNJK 76545 OPOU --------------------------------------------------------------- CUSTOMER 12 --------------------------------------------------------------- I am currently using the below code which is not working out for me. Would appreciate the inputs. proc report data=test headline headskip nowindows; by region; column region ID Company Group Count; define region/noprint; define Group/group; break after count/summarize; define count/group; run;
... View more
02-04-2015
11:34 AM
Let me rephrase the question. I want to dynamically create variables based on the value of addrcount. So if the values of addrcount are 1,2,3 then I want Address_1, Address_2, Address_3 to be created with the corresponding value of Address. data testsort2; set testsort; by id address; if first.address=1 then addrcount=0; if first.address=0 then do; addrcount+1; call symput('addrcount',addrcount); Address_&addrcount.=address; end; run; I Want the output to look something like the following: ID Address Address_1 Address_2 001 Wyoming Avenue 22335 USA Connecticut Avenue 33333 USA France Avenue 55555 USA
... View more
02-04-2015
10:45 AM
I have the below dataset. data test; infile datalines truncover; input ID $9. Address $200.; datalines; 001 Wyoming Avenue 22335 USA 001 Connecticut Avenue 33333 USA 001 France Avenue 55555 USA 001 Wyoming Avenue 22335 USA 001 Connecticut Avenue 33333 USA 001 France Avenue 55555 USA 001 Wyoming Avenue 22335 USA 001 Connecticut Avenue 33333 USA 001 France Avenue 55555 USA ; run; data testsort2; set testsort; by id address; if first.address=1 then addrcount=0; if first.address=0 then do; addrcount+1; call symput('addrcount',addrcount); Address_&addrcount.=address; end; run; In the above code, I want a new Address_addrcount variable to be created when the addrcount changes i.e Address_1, Address_2, Address_3. I need to know how to assign the addrcount value in the same data step. Please help.
... View more
01-28-2015
08:44 AM
Below is the code I have been using for Geocoding in SAS. As you can see, I can read only a few variables from CDF_DEALER_OUT dataset by assigning them to a macro. If I am having, say 200-300 variables, I am in a problem. What can I do if I need to have all the fields from CDF_DEALER_OUT in the final dataset: Geocodes_CDF. Greatly appreciate the help. %macro Geocd; %do i= 1 %to &tot; data _null_; nrec= &i; set CDF_DEALER_OUT point=nrec; call symput('a1',translate(trim(address_old),'+',' ')); call symput('add',trim(address_old)); call symput('add1',trim("Street Address"n)); call symput('city',trim(city)); call symput('zip',trim("Post/Zip Code"n)); call symput('country',trim(Country)); stop; run; filename y url "http://maps.google.com/maps/api/geocode/xml?address=&a1.%nrstr(&sensor=true)"; *Save the XML code to a file and create an XML Map; filename Googlexm 'C:\Nitish\Canada\Googlexml3.xml'; /*if it a poor match then google will either return status= no ok? or produce more than one match*/ data _null_; infile y lrecl= 32000 pad; input; file Googlexm; put _infile_; *******XML code; run; *XML Map tells the XML engine how to map XML markup to a SAS dataset; filename SXLEMAP 'C:\Nitish\Canada\Googlexmlmap3.map'; *Use XML engine in LIBNAME statement to read the XML file; libname Googlexm xml xmlmap=SXLEMAP access=READONLY; data results; length Address_Old $ 200 "Street Address"n $ 92 City $ 29 "Post/Zip Code"n 8 Country $ 20 URL $ 300; Address_Old=symget( 'Add'); "Street Address"n=symget('Add1'); City=symget('City'); "Post/Zip Code"n=symget('Zip'); Country=symget('Country'); URL="http://maps.google.com/maps/api/geocode/xml?address=&a1.%nrstr(&sensor=true)"; set Googlexm.result(rename=(Formatted_Address=Address_Cleaned)); run; *Dataset to hold all geocoded lat and lng; data Geocodes_CDF; set Geocodes_CDF results; run; data _null_ ; time_wait=sleep(2) ; ******Sleep 2 seconds; run; %end; %mend Geocd; %Geocd;
... View more
01-06-2015
06:04 PM
data test; set varin; found=findw('Art festival.','art','','it'); put found=; run; The above code is returning the value of found as 0. Anybody knows why? Even though I am ignoring case and removing trailing blanks from the arguments. If I remove the 't' modifier, the value is returned correctly as 1. If I use STRIP function on the second argument, the value is again returned correctly. Thanks for the help.
... View more
12-30-2014
04:43 AM
I am trying to access the Google Maps API using SAS. I am using the URL engine in FILENAME statement to access the page. Below is the code I am using FILENAME goog url "http://maps.googleapis.com/maps/api/geocode/xml?address=1600+Amphitheatre+Parkway" puser='user' ppass='pass' debug proxy='proxy.com'; However I am getting the following ERROR in log: ERROR: Invalid reply received from the HTTP server. Use the debug option for more info. I am able to access other websites like Yahoo, Google, etc in a similar manner. Help is appreciated.
... View more
12-19-2014
01:32 AM
Hi Patrick, Thanks for the help. Your logic is really helping me a lot. Just wondering how do I match addresses ending with digits using PRX patterns. Example. I want to flag everything ENDING with digits like "Napa Valley Street 10", "Rodeo Drive Suite 212, "Hwy 500". Thanks again for your time.
... View more
12-16-2014
05:57 PM
I am new to regular expressions in SAS and trying to use them for cleaning a few variables in a dataset. The variables are Company_Name and Address. The requirements for company name are as follows: -Should not have special characters (except hyphen) -Should not have country names embedded in it e.g. Hyundai USA Inc. -Should not have any irrelevant text like 'UNKNOWN', 'TBD' etc.---This I can add to the code as per requirements -Should not begin with a number -Should be allowed to include words like LTD, Corp, Inc. and so on. Ideally the cleaned data should look like "Test Company Inc." or "Test Company Corp". Need to work on similar lines for addresses too. I know this is too much to ask for but I would really appreciate it if I can get some help with the coding part of this. Thank you
... View more
12-06-2014
04:06 PM
Thank you for the reply Reeza. I am working on a Master Data Management/Data Cleaning project and required to flag names which programmatically might be correct but not so in real world. Insert Name is not a valid human name but Robin Hood might be, so accordingly, there is a need to highlight such cases. The above logic mentioned by you surely eliminates the other cases. Thank you for that!
... View more
- « Previous
- Next »