Does it do anything? It seems to ignore it and treat my delimited file as a flat file.
@tomcmacdonald wrote:
Does it do anything?
Yes.
@tomcmacdonald wrote:
It seems to ignore it and treat my delimited file as a flat file.
You're using it incorrectly then.
Why does it bleed over into the other column? Doesn't SAS know to stop when it hits the delimiter?
@tomcmacdonald wrote:
Doesn't SAS know to stop when it hits the delimiter?
That's what it does. Like I said, you're likely doing something wrong. You need to show your code, log and ideally sample data that reflects your situation
I just find the fact that it's bleeding over to be pretty bizarre. You figure SAS would throw an error at least.
If SAS can do what you tell it to do, there's no reason to throw an error. And there are valid reasons for mixing list and formatted input (I guess that is the reason for your problem) at certain times.
@tomcmacdonald wrote:
Why does it bleed over into the other column? Doesn't SAS know to stop when it hits the delimiter?
Show your log where you run the code Preferably in a code box opened with the forum's {I} icon. Also best would be to provide some example of the data file. Do not paste your data example into the main window but use a code box. The main message windows reformat pasted text.
there are potentially lots of interactions but the one I see here most frequently that sounds like what you describe is placing a format as part of the INPUT.
If you have
input var $10. it will read 10 characters pretty much.
informat var $10. ;
input var;
will read var as charcter up to the first delimiter if the infile is declared with the correct delimiter.
Other options such as DSD also have an impact.
@tomcmacdonald wrote:
Why does it bleed over into the other column? Doesn't SAS know to stop when it hits the delimiter?
Please look at these code examples. Does your code look at all like the first one?
Note that the values of x and y vary between the two sets because the second is one preferred way to specify informats that respect delimiters;
data example; infile datalines dlm=','; length x $ 5; informat y z $5.; /* a format on an input statement ignores the delimiter because you are forcing a read of 5 columns */ input x $5. y z; datalines; 123,abcd,fghijk ; run; data example2; infile datalines dlm=','; length x y z $5.; input x y z; datalines; 123,abcd,fghijk ; run;
Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.
Register today!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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: