Usage Note 36398: Creating a program to identify all occurrences of a value across many different columns in a data set
The VNAME function returns the name of the variable that is associated with a given array reference. The following sample program shows how this works. Notice the final DATA step; the first two steps just generate some sample data.
/*Make up some sample data*/
data data;
do obs=1 to 20;
do varnum=1 to 10;
varname='NumVar'!!left(varnum);
value=round(ranuni(123)*10);
output;
end;
end;
run;
proc transpose data=data out=testdata(drop=obs _name_);
by obs;
var value;
id varname;
run;
data testdata;
set testdata;
length refused $ 200;
array numvar {10};
do index=1 to 10;
if numvar{index}=7 then refused=catx(' ',refused,vname(numvar{index}));
end;
run;
proc print data=testdata;
run;
View Question from the Field archives.
Operating System and Release Information
| SAS System | Base SAS | z/OS | | |
| OpenVMS VAX | | |
| Microsoft® Windows® for 64-Bit Itanium-based Systems | | |
| Microsoft Windows Server 2003 Datacenter 64-bit Edition | | |
| Microsoft Windows Server 2003 Enterprise 64-bit Edition | | |
| Microsoft Windows XP 64-bit Edition | | |
| Microsoft® Windows® for x64 | | |
| OS/2 | | |
| Microsoft Windows 95/98 | | |
| Microsoft Windows 2000 Advanced Server | | |
| Microsoft Windows 2000 Datacenter Server | | |
| Microsoft Windows 2000 Server | | |
| Microsoft Windows 2000 Professional | | |
| Microsoft Windows NT Workstation | | |
| Microsoft Windows Server 2003 Datacenter Edition | | |
| Microsoft Windows Server 2003 Enterprise Edition | | |
| Microsoft Windows Server 2003 Standard Edition | | |
| Microsoft Windows Server 2008 | | |
| Microsoft Windows XP Professional | | |
| Windows Millennium Edition (Me) | | |
| Windows Vista | | |
| 64-bit Enabled AIX | | |
| 64-bit Enabled HP-UX | | |
| 64-bit Enabled Solaris | | |
| ABI+ for Intel Architecture | | |
| AIX | | |
| HP-UX | | |
| HP-UX IPF | | |
| IRIX | | |
| Linux | | |
| Linux for x64 | | |
| Linux on Itanium | | |
| OpenVMS Alpha | | |
| OpenVMS on HP Integrity | | |
| Solaris | | |
| Solaris for x64 | | |
| Tru64 UNIX | | |
*
For software releases that are not yet generally available, the Fixed
Release is the software release in which the problem is planned to be
fixed.
Question from the Field
| Date Modified: | 2009-06-29 15:33:28 |
| Date Created: | 2009-06-29 14:19:21 |