07-06-2015 07:18 AM
I'm reading in a txt file into sas and write up the fields and attributes in columns in excel and then copy and paste into sas. However, the columns don't line up in sas. Is there a way to paste the data so that it looks like...
07-06-2015 07:24 AM
Why would you want to be copying code from and Excel file in the first place? Integrated Development Environments and text editors are the tools for coding.
Your problem lies in the fact that Excel has cells, nothing else has this concept. When you copy it takes the text out of those cells, puts a space in between and then keeps it on the clipboard. When you paste this text then gets pasted in the SAS text file. I know that some of the more modern IDEs allow textual alignments to markers (a bit like Word where you can move the ticks at the top and align text to that), but at least up to 9.3 I don't think this was possible. My suggestion - avoid using Excel for anything.
07-06-2015 09:54 AM
Import the Excel file into SAS, and then use formatted output to write a file with the correct spacings. You can then copy/paste from there.
07-06-2015 09:07 AM
There is the Enhanced Editor and basic Editor. Neither of which has alignment controls other than to put spaces instead of tabs. What are you trying to do though? If its just a parameter list, put it in a text file and %include or infile it in, doesn't seem to be much point in copy/pasting it.
07-06-2015 09:50 AM
EG also has a format your code option.
TWo other things to try:
1. Cut and paste each column using ALT key. I think this works but not in front of SAS to try.
2 Create the appropriate text in Excel using Concatenate and length functions before pasting to SAS.
07-06-2015 12:09 PM
Whenever I need to do this, I do it in Excel.
Assuming that my variable name is in cell A1, and my length in B1, the formula
should give you attractive output. Substitute whichever number looks good for the two instances of 20.