It is possible to place a \label without a \caption. The required code (which is also used by \caption) is \refstepcounter{<counter-type>}. So to set a label to your figure you could use \refstepcounter{figure}\label{PROGRAM:HELLO-WORLD}.
\documentclass[]{article}
\usepackage{tikz}
\begin{document}
\begin{figure}
\begin{tikzpicture}
\node at (0,0) {Foo};
\end{tikzpicture}%
\refstepcounter{figure}\label{PROGRAM:HELLO-WORLD}%
\end{figure}
\ref{PROGRAM:HELLO-WORLD}
\end{document}
If you already used a \caption (which I can't inside of tikzpicture) you'd get misnumbered labels this way. To compensate the additional step you could do a \addcounter{figure}{-1}, so the labeling code would become:
\addcounter{figure}{-1}\refstepcounter{figure}\label{PROGRAM:HELLO-WORLD}
As @JohnKormylo mentioned a way to put a caption inside of a tikzpicture (surrounding it in a minipage or like in the following a \parbox) here is the proper way of setting the \label in that case:
\documentclass[]{article}
\usepackage{tikz}
\begin{document}
\begin{figure}
\begin{tikzpicture}
\node at (0,0)
{\parbox{.8\textwidth}{\caption{Foo\label{PROGRAM:HELLO-WORLD}}}};
\end{tikzpicture}%
\end{figure}
\ref{PROGRAM:HELLO-WORLD}
\end{document}
\captionin the figure, before the\label. – Phelype Oleinik Sep 22 '18 at 16:05\documentclassand ending with\end{document}. – Hafid Boukhoulda Sep 22 '18 at 17:18\captionis to include the label in the mandatory argument:\caption{This is my caption\label{fig:foo}}. Make sure to not accidentally include whitespace before or after the\labelthough. – Skillmon Sep 22 '18 at 17:44\captionhas to be outside of the tikzpicture environment. I don't thinktikzcan accept a caption outside of aminipageand withoutcaptionorsubcaptionpackage – koleygr Sep 22 '18 at 19:57\node [text width=5cm] {\caption{foo}};for example would work fine, because thetext widthsetting of the node makes the node into aminipagelike box. – Torbjørn T. Sep 23 '18 at 07:21