1
votes

Here's the background. I'm sorry it's so long:
I do SAS programming for 3 different projects. Each project has its own main project folder. Each main project folder contains a formats folder (which contains the format catalog), and then several other folders, each of which contains programs and datasets. I do most of my work in batch mode, so SAS is usually not open. Occasionally, though, I want to open a dataset in SAS to look at something in particular. When I do this, SAS does not know where to look for the appropriate format catalog, because the format catalogs are never in the same folder as the datasets. So I currently use an autoexec.sas file that specifies the nofmterr option, so that my datasets will open.

I would really like, though, to be able to open my datasets with the appropriate formatting. I wrote a different autoexec program that uses a dialog window that asks me which project I am working on and then sets the fmtsearch option accordingly. This works great if I want to first open SAS, and then open a dataset. But if SAS is not already up and running, and I try to open a dataset by double-clicking on it, here's what happens: the autoexec file starts running, then SAS tries to open the dataset before the autoexec file has finished running. So if I have nofmterr set, the dataset will open without formats, or if I don't have nofmterr set, the dataset won't open at all.

So here's my question: Is there a way to get SAS to wait until the autoexec file finishes running before it tries to open the dataset? Or, is there another way around the problem? (I don't want to add all 3 format files to the fmtsearch option, because different projects might have different formats with the same name.)

1

1 Answers

1
votes

Since the dataset is opening without any code running before hand, this becomes quiet difficult. Is it possible to open the dataset as a parameter of a code. I envision something like this:

commandline:/sas ./opends.sas -sysparm "/this/is/the/dataset/location_and_name"

Your code "opends.sas" would include all of the relavent formatting information for your project.

You could even write a script (bash or batch depending on OS) that has all of the above predefined and you could call the script with the dataset as a parameter.

I know this seems cumbersome, but it is the first solution I could come up with based on your description.

--Added 20090218

The opends.sas script should take in a sysparm variable and depending on the operating system, it should print the dataset or issue a command to open the dataset.