@jswinford wrote:
I've tried putting the SET statements where the should be (at the top), and then SAS keeps telling me I need to put LENGTH before SET in the Log. So I've already tried doing that.
I tried using LENGTH to change the length but it wouldn't let me do that either so I used FORMAT and that changed the length and format in the code
I was "overwriting" the input because for some reason, simple coding isn't working. Starting to wonder if there's something wrong with the input file.
I am going to see if your code works.
You cannot change the LENGTH of a character variable after SAS has already defined the variable. So if the source dataset already have a variable named CHAR_DATE then putting the LENGTH statement after the SET statement will generate a warning from SAS and be ignored. You can change the FORMAT attached to a variable, but that just changes how it is displayed and not how long it really is. So you could attach $600. format to variable that has length of $10 (and the reverse!).
Most likely the problems you had with using the LENGTH statement were related to using the same dataset name for the input and output of the data step and running the step more than once. So the first time the LENGTH statement defined a new varaible, but then when you ran it again reading the updated dataset it will ignore the LENGTH statement since the variable was already defined. You can use the DROP= dataset option to eliminate a variable that you want to recreate from other data.
... View more