12-01-2015 05:39 AM
hello i am trying to display numeric or character variable in a particular data set but having issues wats warong!!1 thanks in advance
12-01-2015 05:51 AM
The reason for getting the WARNINGS is that either the dataset name or the variable you are passing into the parameters dsname and varname is not there.
Else the macro is working well.
Please check if the dsname i mean the dataset you are passing is there in work or any library and also make sure that variable name you are passing is also there in the dataset.
12-01-2015 06:45 AM
This really is the same question as the numerous other questions posted here. The answers to your syntax errors will be the same.
For your reference on what you are trying to do, I attach screenshots to the SAS metadata datasets, which contain all the information you need, are automatically created and maintained by the SAS system, and are widely recognised and understood by SAS programmers.
SASHELP.VCOLUMNS (or DICTIONARY.COLUMNS in SQL):
SASHELP.VTABLE (or DICTIONARY.TABLES in SQL):
12-01-2015 07:51 AM
@RW9: Telling from RTelang's previous posts, he (or she) is not working on a specific task, but learning macro programming just for the sake of it.
@RTelang: The log excerpt that you present is incomplete and not consistent: Running only the code that is shown, one would obtain the following log messages:
WARNING: Argument 1 to function VARNUM referenced by the %SYSFUNC or %QSYSFUNC macro function is out of range.
WARNING: Argument 1 to function VARTYPE referenced by the %SYSFUNC or %QSYSFUNC macro function is out of range.
The NOTE would be suppressed by the NONOTES option and the WARNINGs would refer to "Argument 1", because your macro call "%vtype;" does not pass any parameter values to the macro. I think you should reread the documentation on macro parameters (see %MACRO Statement) to improve your understanding.
I conclude you have created a global macro variable DSNAME (probably by using a %LET statement not shown in your log excerpt) and stored the name of an existing dataset in it. Therefore, macro variable DSID received a valid dataset ID and only &VARNAME did not resolve to a valid variable name in the dataset mentioned (hence the issues with "Argument 2").
Creating a global macro variable with the same name as the parameter of a macro can easily cause confusion. If you had correctly specified the parameter values in your macro call (e.g. %vtype(dsname=sashelp.class, varname=age)), the content of the global macro variable DSNAME would have been ignored ("shadowed" by the parameter value stored in the local macro variable DSNAME) during macro execution.
Finally, if you use the OPEN function, please don't forget to close the opened datasets by using the CLOSE function at the end. Otherwise, people can no longer overwrite or delete the affected datasets.
12-02-2015 12:30 AM