
05-26-2020
LOLO
Obsidian | Level 7
Member since
11-09-2012
- 27 Posts
- 0 Likes Given
- 1 Solutions
- 4 Likes Received
-
Latest posts by LOLO
Subject Views Posted 1393 05-26-2020 09:22 AM 1426 05-25-2020 05:18 PM 1579 05-24-2020 03:56 PM 965 08-02-2018 03:02 PM 944 08-02-2018 02:14 PM 960 08-02-2018 01:51 PM 4525 05-23-2018 09:04 PM 4528 05-23-2018 08:33 PM 4574 05-23-2018 03:41 PM 4579 05-23-2018 03:28 PM -
Activity Feed for LOLO
- Posted Re: How do I use a previous row to evaluate the current row iteratively? on SAS Programming. 05-26-2020 09:22 AM
- Posted Re: How do I use a previous row to evaluate the current row iteratively? on SAS Programming. 05-25-2020 05:18 PM
- Posted How do I use a previous row to evaluate the current row iteratively? on SAS Programming. 05-24-2020 03:56 PM
- Posted Re: Writing to Pipe delimited - error 'some output data maybe lost because dropover option was speci on SAS Programming. 08-02-2018 03:02 PM
- Posted Re: Writing to Pipe delimited - error 'some output data maybe lost because dropover option was speci on SAS Programming. 08-02-2018 02:14 PM
- Posted Writing to Pipe delimited - error 'some output data maybe lost because dropover option was specified on SAS Programming. 08-02-2018 01:51 PM
- Posted Re: Options fmtsearch=(....) not working!!! on SAS Programming. 05-23-2018 09:04 PM
- Posted Re: Options fmtsearch=(....) not working!!! on SAS Programming. 05-23-2018 08:33 PM
- Posted Re: Options fmtsearch=(....) not working!!! on SAS Programming. 05-23-2018 03:41 PM
- Posted Options fmtsearch=(....) not working!!! on SAS Programming. 05-23-2018 03:28 PM
- Posted Running a do loop until a criteria is met on SAS Programming. 04-22-2018 09:44 PM
- Posted Re: Convert 32 bit catalog to 64 bit catalog on SAS Programming. 04-18-2018 10:26 PM
- Posted Convert 32 bit catalog to 64 bit catalog on SAS Programming. 04-18-2018 10:04 PM
- Posted Re: Truncation of DBMS column names on SAS Programming. 02-23-2018 11:30 AM
- Got a Like for Truncation of DBMS column names. 02-22-2018 08:42 PM
- Got a Like for Truncation of DBMS column names. 02-22-2018 06:32 PM
- Posted Truncation of DBMS column names on SAS Programming. 02-22-2018 04:33 PM
- Posted Re: Rerouting log and output to another location on SAS Programming. 01-30-2018 09:03 PM
- Got a Like for Rerouting log and output to another location. 01-30-2018 02:56 PM
- Posted Rerouting log and output to another location on SAS Programming. 01-30-2018 02:47 PM
-
My Liked Posts
Subject Likes Posted 2 02-22-2018 04:33 PM 2 01-30-2018 02:47 PM
05-26-2020
09:22 AM
This works! And it's so simple. Thank you.
... View more
05-25-2020
05:18 PM
Yes you are correct. I am a SAS programmer but I need to write some code in AZURE Data Studio. So Yes I have to use SQL Server. So I am trying to figure this out in SAS first and then apply it in SQL. Any ideas?
... View more
05-24-2020
03:56 PM
I am looking at a data set of Emergency Room visits. I only want to keep visits per ID that are 30 days apart. So as an example say I have this below. If I start with ID=1. In Row 1 I can see that the lag between row 1 and 2 is 15 days so I will exclude, or for now flag, row 2. Then I will continue to use Row 1 to evaluate Row 3. Again this is only 17 days so I will exclude Row 3 and look at Row 4. Row 4 is 30 days away so I keep it and then use Row 4 to evaluate Row 5....and so on. I have been trying to do this with the lag function but I can't figure out how to utilize the lag when I have to continue to use the 'anchor' row to evaluate several rows. Top is what I have and bottom is what I want. Any ideas??? If anyone knows how to do this using Proc SQL that would be even better. Much appreciated.
HAVE
Row #
ID
1
1
1/1/2020
2
1
1/15/2020
3
1
1/17/2020
4
1
2/4/2020
5
1
3/15/2020
6
2
1/15/2020
7
2
3/15/2020
8
2
3/18/2020
WANT
Row #
ID
1
1
1/1/2020
4
1
2/4/2020
5
1
3/15/2020
6
2
1/15/2020
7
2
3/15/2020
... View more
08-02-2018
03:02 PM
I figured it out! That last @ in the put statements causes the carriage return. Once I remove it works 🙂
... View more
08-02-2018
02:14 PM
I would like the variable names listed across the top - so for simplicity sake 4 rows. My actual data has 265 variables and 200,000 records. Am I missing a 'put?' When I look at the txt file it creates it looks like a 'flowover' so the second records starts on the same line as the first record.
... View more
08-02-2018
01:51 PM
Hi, I have used this code to write to a pipe delimited file so many times and for some reason today it will not work on a data set. I get the error 'Some output data may be lost because DROPOVER option was specified.' So out of 200,000 records it only outputs 2 records.
%let outfile=want;
data _null_;
%let _EFIERR_=0;
%let _EFIREC_=0;
file "&outfile." DSD delimiter='|' DSD DROPOVER lrecl=32767;
if _n_=1 then do;
put
"var1"
'|'
"var2"
'|'
"var3"
'|'
"varN"
; end;
set have end=EFIEOD;
format var1 $4.;
format var2 $6.;
format var3 best12.;
format varN best12;
do
EFIOUT +1;
put var1 $@;
put var2 $@;
put var3 @;
put varN @;
end;
if _ERROR_ then call symputx('_EFIERR_',1);
if EFIEOD then call symputx('_EFIREC_',EFIOUT) ;
run;
I cannot figure out what I am doing wrong. Any thoughts?? Anyone else seen this error? THANKS!
... View more
05-23-2018
09:04 PM
More information. I inherited a data file that had formats (formats1). How do I replace those formats with formats2? Maybe this is why it doesn't work, it keeps seeing the old formats from formats1?
... View more
05-23-2018
08:33 PM
Right...it is very confusing because I feel like it should work too. The format I want is in formats2. In a previous program I had called formats1 and applied those formats. I have a question. Would it make more sense to use a datasets statement and remove all formats and then do the frmtsearch option? It makes no sense to me.
... View more
05-23-2018
03:41 PM
ha was a typo... I have it written correctly in the program. Sorry!
... View more
05-23-2018
03:28 PM
I have two different format catalogs which I need to use depending on how the client needs the output displayed.
%let fmt1=formats1 ;
%let fmt2=formats2 ;
libname fmts "\\path\formats" ;
options fmtsearch=(fmts.formats2 fmts.formats2 work library) ;
Each catalog has about 100 different formats, some of them the same and some different.
proc print data =mydata ; var var1-var3 ; run ;
So I want the data file to look into formats2 to apply the formats. Formats1 was created first and I have applied these formats to 'mydata' in a previous program. Now I want SAS to apply formats2 instead of formats1. I did what SAS said and put the order into the fmtsearch option, but I still get results showing the formats1 formats. What am I doing wrong? I'm running this in Batch.
Thanks!
Lorena
... View more
04-22-2018
09:44 PM
I have a macro do loop I am running and I want the flag to be applied as soon as the condition is met. Right now it is only applying it to the last variable in the loop. Diag1-Diag24 are diagnosis codes that I am looking through to find the value of the code I need to flag.
%let dxnum=24;
%macro test(s);
%do s=1 %to &dxnum. ;
if ("T36" <=substr(diag&s.,1,3)<="T50") then flag=1 ;
%end;
%mend test;
%test
This works but it only picks up the values in diag24. I feel like I need to do a do until or a 'leave' but I've tried a dozen different ways with no luck. I need flag=1 whenever it meets that condition in any of the variables diag1-diag24. Once it flags it once it can leave the loop.
Any ideas???
... View more
04-18-2018
10:26 PM
I also want to add that I am working in batch mode, not sure if that makes a difference.
... View more
04-18-2018
10:04 PM
I know this question is asked a lot and I've read as much as I could to see if I can figure this out on my own. Here are my issues.
1. I don't have access to 32 bit SAS
2. I inherited the catalogs and I cannot go back and ask them for the code that creates the catalogs.
So I am stuck with trying to convert them. I tried using the cport method but I still get that error that says 'ERROR the catalog was created for a different operating system.' I am wondering if anyone has any ideas on how to get this done??!! This is causing me such a big headache!
Thanks!
... View more
02-23-2018
11:30 AM
Thank you so much to all of you! A combination of all of your responses got me what I needed. it is so crazy that this is such a problem. smh
... View more
02-22-2018
04:33 PM
2 Likes
I know this is an issue that comes up over and over and I've been reading posts about it all day trying to figure this out. I inherited a program that used to use an SQL pass through method to load data. This is no longer available to me and so now we are connecting to the SQL server more directly but it is causing a problem with the truncation of the column names. There are many tables and many variables and sometimes there will be several variables that all exceed 32 characters but that have the same 32 characters to begin with.
example:
var1=abcdefghijklmnopqrstuvwxyzaaaaaabb
var2=abcdefghijklmnopqrstuvwxyzaaaaaacc
var3=abcdefghijklmnopqrstuvwxyzaaaaaadd
So what happens right now is that var1 gets truncated to abcdefghijklmnopqrstuvwxyzaaaaaa and var2 and var3 are dropped.
What I want:
var1=abcdefghijklmnopqrstuvwxyzaaaaa1
var2=abcdefghijklmnopqrstuvwxyzaaaaa2
var3=abcdefghijklmnopqrstuvwxyzaaaaa3
My simplified code looks something like this:
Libname test odbc dsn=dataset schema=xx preserve_col_names=yes;
Proc sql ;
Create table xxx select
x.*
from yyy;
quit;
Does anyone know of any option that tells SAS to go ahead and truncate but add numeric suffixes to variables with the same first 32 characters??
THANK YOU!!
... View more